summaryrefslogtreecommitdiff
path: root/src/vm/mlinfo.cpp
diff options
context:
space:
mode:
authorJeremy Koritzinsky <jkoritzinsky@gmail.com>2019-04-05 12:52:00 -0700
committerGitHub <noreply@github.com>2019-04-05 12:52:00 -0700
commit04f97c9923156b0c695f5fe441ffd14624de8076 (patch)
tree39dabb413ee77c1fc50b6b5f22f392a9f7d0e362 /src/vm/mlinfo.cpp
parent8d51f4253996baf64fca1c57c421fb42ac5762cd (diff)
downloadcoreclr-04f97c9923156b0c695f5fe441ffd14624de8076.tar.gz
coreclr-04f97c9923156b0c695f5fe441ffd14624de8076.tar.bz2
coreclr-04f97c9923156b0c695f5fe441ffd14624de8076.zip
Enable return buffers on Windows ARM64 for struct-returning member functions (#23625)
* Enable return buffers on Windows ARM64 for struct-returning member functions. Fixes #23577. * Update comment to match new condition. * Enable byref return on all Windows (excluding arm64 HFA. Add more test cases for ThisCall. * On x86, if we have a normalized return value in an instance method, get back the actual type so that we correctly marshal it via a return buffer. * Fix param ordering. * Clean up based on PR feedback. * Fix accidental variable shadowing.
Diffstat (limited to 'src/vm/mlinfo.cpp')
-rw-r--r--src/vm/mlinfo.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/vm/mlinfo.cpp b/src/vm/mlinfo.cpp
index cb512bb4f0..2e675fde2a 100644
--- a/src/vm/mlinfo.cpp
+++ b/src/vm/mlinfo.cpp
@@ -1412,6 +1412,7 @@ MarshalInfo::MarshalInfo(Module* pModule,
BOOL BestFit,
BOOL ThrowOnUnmappableChar,
BOOL fEmitsIL,
+ BOOL onInstanceMethod,
MethodDesc* pMD,
BOOL fLoadCustomMarshal
#ifdef _DEBUG
@@ -1514,8 +1515,9 @@ MarshalInfo::MarshalInfo(Module* pModule,
}
nativeType = ParamInfo.m_NativeType;
+
corElemType = sig.PeekElemTypeNormalized(pModule, pTypeContext);
- mtype = corElemType;
+ mtype = corElemType;
#ifdef FEATURE_COMINTEROP
if (IsWinRTScenario() && nativeType != NATIVE_TYPE_DEFAULT)
@@ -1643,8 +1645,15 @@ MarshalInfo::MarshalInfo(Module* pModule,
// "un-normalized" signature type. It has to be verified that all the value types
// that have been normalized away have default marshaling or MarshalAs(Struct).
// In addition, the nativeType must be updated with the type of the real primitive inside.
- //
- VerifyAndAdjustNormalizedType(pModule, sig, pTypeContext, &mtype, &nativeType);
+ // We don't normalize on return values of member functions since struct return values need to be treated as structures.
+ if (isParam || !onInstanceMethod)
+ {
+ VerifyAndAdjustNormalizedType(pModule, sig, pTypeContext, &mtype, &nativeType);
+ }
+ else
+ {
+ mtype = sig.PeekElemTypeClosed(pModule, pTypeContext);
+ }
#endif // _TARGET_X86_
@@ -2753,6 +2762,7 @@ MarshalInfo::MarshalInfo(Module* pModule,
// (returning small value types by value in registers) is already done in JIT64.
if ( !m_byref // Permit register-sized structs as return values
&& !isParam
+ && !onInstanceMethod
&& CorIsPrimitiveType(m_pMT->GetInternalCorElementType())
&& !IsUnmanagedValueTypeReturnedByRef(nativeSize)
&& managedSize <= sizeof(void*)