Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Andreenko <seandree@microsoft.com>2021-01-22 00:37:42 +0300
committerGitHub <noreply@github.com>2021-01-22 00:37:42 +0300
commit648437b1b4db6536ae33763b6c9178287c0a52bd (patch)
tree5bf1bad563b8a080154d14da93ef3d23a437e751 /src/coreclr/vm/mlinfo.cpp
parentbf573c7e2dec65f2db36994436f8396c76789df5 (diff)
Arm64 apple vm fixes for arg alignment. (#46665)
* Add `MarshalInfo::IsValueClass`. * Add `TypeHandle* pTypeHandle` to `SizeOf`. * Add a few asserts/start using inline function instead of macro. * use TARGET_POINTER_SIZE instead of STACK_ELEM_SIZE. * Use `m_curOfs` instead of `m_idxStack` in `ArgIteratorBase` on all platforms. Before some platforms were using stackSlots, some curOfs in bytes. * Use byte sizes and offsets in `ArgLocDesc`. Fix arm32. x86 fixes. use StackSize on ArgSizes Add `GetStackArgumentByteIndexFromOffset` and return back the old values for asserts. another fix * Stop using `#define STACK_ELEM_SIZE` * Add `isFloatHfa`. * delete checking code. because it won't pass on arm64 apple. * arm64 apple fixes. * roundUp the stack size. * Add a reflection test. * Return byte offset from `GetNextOfs`. It is not a complete fix for arm64 apple, but covers most cases. * Add `FLOAT_REGISTER_SIZE` * Use StackElemSize for ` pLoc->m_byteStackSize`. * replace `assert` with `_ASSERTE`. * Use `ALIGN_UP` in the code that I have changed. * rename `m_curOfs` as `m_ofsStack`. * delete "ceremony " from `StackElemSize`. * Delete `cSlots` and don't call `StackElemSize` on `GetArgSize`. * Fix an assert. * Fix nit. * fix wrong return for hfa<float>. * fix nit. * Fix crossgen job.
Diffstat (limited to 'src/coreclr/vm/mlinfo.cpp')
-rw-r--r--src/coreclr/vm/mlinfo.cpp41
1 files changed, 28 insertions, 13 deletions
diff --git a/src/coreclr/vm/mlinfo.cpp b/src/coreclr/vm/mlinfo.cpp
index 1097bbea2a6..71788db9efd 100644
--- a/src/coreclr/vm/mlinfo.cpp
+++ b/src/coreclr/vm/mlinfo.cpp
@@ -2873,18 +2873,27 @@ void MarshalInfo::SetupArgumentSizes()
}
CONTRACTL_END;
+ const unsigned targetPointerSize = TARGET_POINTER_SIZE;
+ const bool pointerIsValueType = false;
+ const bool pointerIsFloatHfa = false;
+ _ASSERTE(targetPointerSize == StackElemSize(TARGET_POINTER_SIZE, pointerIsValueType, pointerIsFloatHfa));
+
if (m_byref)
{
- m_nativeArgSize = StackElemSize(TARGET_POINTER_SIZE);
+ m_nativeArgSize = targetPointerSize;
}
else
{
- m_nativeArgSize = StackElemSize(GetNativeSize(m_type));
+ const bool isValueType = IsValueClass(m_type);
+ const bool isFloatHfa = isValueType && (m_pMT->GetHFAType() == CORINFO_HFA_ELEM_FLOAT);
+ m_nativeArgSize = StackElemSize(GetNativeSize(m_type), isValueType, isFloatHfa);
}
#ifdef ENREGISTERED_PARAMTYPE_MAXSIZE
if (m_nativeArgSize > ENREGISTERED_PARAMTYPE_MAXSIZE)
- m_nativeArgSize = StackElemSize(TARGET_POINTER_SIZE);
+ {
+ m_nativeArgSize = targetPointerSize;
+ }
#endif // ENREGISTERED_PARAMTYPE_MAXSIZE
}
@@ -2909,16 +2918,8 @@ UINT16 MarshalInfo::GetNativeSize(MarshalType mtype)
if (nativeSize == VARIABLESIZE)
{
- switch (mtype)
- {
- case MARSHAL_TYPE_BLITTABLEVALUECLASS:
- case MARSHAL_TYPE_VALUECLASS:
- case MARSHAL_TYPE_BLITTABLEVALUECLASSWITHCOPYCTOR:
- return (UINT16) m_pMT->GetNativeSize();
-
- default:
- _ASSERTE(0);
- }
+ _ASSERTE(IsValueClass(mtype));
+ return (UINT16) m_pMT->GetNativeSize();
}
return nativeSize;
@@ -2945,6 +2946,20 @@ bool MarshalInfo::IsInOnly(MarshalType mtype)
return ILMarshalerIsInOnly[mtype];
}
+bool MarshalInfo::IsValueClass(MarshalType mtype)
+{
+ switch (mtype)
+ {
+ case MARSHAL_TYPE_BLITTABLEVALUECLASS:
+ case MARSHAL_TYPE_VALUECLASS:
+ case MARSHAL_TYPE_BLITTABLEVALUECLASSWITHCOPYCTOR:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
OVERRIDEPROC MarshalInfo::GetArgumentOverrideProc(MarshalType mtype)
{
CONTRACTL