This checkin has two changes:
1) Add a check to ensure that methods with struct-returns are
use the fat header which encodes ReturnKind in 4 bits.
2) Fix a bug in GetReturnKind().
Commit migrated from https://github.com/dotnet/coreclr/commit/
a12ba4633d0fea6792fcb73ed363f49e336f3f62
BOOL slimHeader = (!m_IsVarArg && !hasSecurityObject && !hasGSCookie && (m_PSPSymStackSlot == NO_PSP_SYM) &&
!hasContextParamType && !m_WantsReportOnlyLeaf && (m_InterruptibleRanges.Count() == 0) && !hasReversePInvokeFrame &&
((m_StackBaseRegister == NO_STACK_BASE_REGISTER) || (NORMALIZE_STACK_BASE_REGISTER(m_StackBaseRegister) == 0))) &&
- (m_SizeOfEditAndContinuePreservedArea == NO_SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA);
+ (m_SizeOfEditAndContinuePreservedArea == NO_SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA) &&
+ !IsStructReturnKind(m_ReturnKind);
// All new code is generated for the latest GCINFO_VERSION.
// So, always encode RetunrKind and encode ReversePInvokeFrameSlot where applicable.
;
}
+inline bool IsStructReturnKind(ReturnKind returnKind)
+{
+ // Two bits encode integer/ref/float return-kinds.
+ // Encodings needing more than two bits are (non-scalar) struct-returns.
+ return returnKind > 3;
+}
+
// Helpers for combining/extracting individual ReturnKinds from/to Struct ReturnKinds.
// Encoding is two bits per register
if (gcInfoToken.IsReturnKindAvailable())
{
GcInfoDecoder gcInfoDecoder(gcInfoToken, DECODE_RETURN_KIND);
- ReturnKind returnKind = gcInfoDecoder.GetReturnKind();
+ returnKind = gcInfoDecoder.GetReturnKind();
}
#endif // _TARGET_X86_