summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarol Eidt <carol.eidt@microsoft.com>2019-01-10 11:01:48 -0800
committerGitHub <noreply@github.com>2019-01-10 11:01:48 -0800
commit04c0dc71dfd15432ba5f8be9ad8947146bc58e55 (patch)
treebf99e7102ebfb166cca0f6f63e2caf33d99ec230
parent4e6ff628eaebcf32c9ea599b2d47f3290860728e (diff)
parentebcd9d20f5e6b454a4efb0675610fac998c7c8f6 (diff)
downloadcoreclr-04c0dc71dfd15432ba5f8be9ad8947146bc58e55.tar.gz
coreclr-04c0dc71dfd15432ba5f8be9ad8947146bc58e55.tar.bz2
coreclr-04c0dc71dfd15432ba5f8be9ad8947146bc58e55.zip
Merge pull request #21815 from CarolEidt/Fix752890
[x86] Make copies of odd-size struct arguments
-rw-r--r--src/jit/codegenxarch.cpp6
-rw-r--r--src/jit/morph.cpp8
2 files changed, 10 insertions, 4 deletions
diff --git a/src/jit/codegenxarch.cpp b/src/jit/codegenxarch.cpp
index 37cd2661f7..ec43cdd0f3 100644
--- a/src/jit/codegenxarch.cpp
+++ b/src/jit/codegenxarch.cpp
@@ -5302,6 +5302,12 @@ void CodeGen::genCallInstruction(GenTreeCall* call)
{
GenTreeObj* obj = source->AsObj();
unsigned argBytes = roundUp(obj->gtBlkSize, TARGET_POINTER_SIZE);
+#ifdef _TARGET_X86_
+ // If we have an OBJ, we must have created a copy if the original arg was not a
+ // local and was not a multiple of TARGET_POINTER_SIZE.
+ // Note that on x64/ux this will be handled by unrolling in genStructPutArgUnroll.
+ assert((argBytes == obj->gtBlkSize) || obj->Addr()->IsLocalAddrExpr());
+#endif // _TARGET_X86_
assert((curArgTabEntry->numSlots * TARGET_POINTER_SIZE) == argBytes);
}
#endif // FEATURE_PUT_STRUCT_ARG_STK
diff --git a/src/jit/morph.cpp b/src/jit/morph.cpp
index 3009f887e8..1cf4f37747 100644
--- a/src/jit/morph.cpp
+++ b/src/jit/morph.cpp
@@ -3831,7 +3831,6 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* call)
unsigned roundupSize = (unsigned)roundUp(originalSize, TARGET_POINTER_SIZE);
var_types structBaseType = argEntry->argType;
-#ifndef _TARGET_X86_
// First, handle the case where the argument is passed by reference.
if (argEntry->passedByRef)
{
@@ -3841,9 +3840,10 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* call)
assert(!"Structs are not passed by reference on x64/ux");
#endif // UNIX_AMD64_ABI
}
- else
+ else // This is passed by value.
{
- // This is passed by value.
+
+#ifndef _TARGET_X86_
// Check to see if we can transform this into load of a primitive type.
// 'size' must be the number of pointer sized items
assert(size == roundupSize / TARGET_POINTER_SIZE);
@@ -4053,6 +4053,7 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* call)
size = 1;
}
+#endif // !_TARGET_X86_
#ifndef UNIX_AMD64_ABI
// We still have a struct unless we converted the GT_OBJ into a GT_IND above...
@@ -4087,7 +4088,6 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* call)
}
#endif // !UNIX_AMD64_ABI
}
-#endif // !_TARGET_X86_
}
if (argEntry->isPassedInRegisters())