Skip to content

Commit

Permalink
Merge pull request dotnet#6908 from swaroop-sridhar/retKind
Browse files Browse the repository at this point in the history
GcInfo: Don't use slim header for methods with struct-returns
  • Loading branch information
swaroop-sridhar authored Aug 26, 2016
2 parents 2476368 + a12ba46 commit dc52f8b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/gcinfo/gcinfoencoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,8 @@ void GcInfoEncoder::Build()
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.
Expand Down
7 changes: 7 additions & 0 deletions src/inc/gcinfotypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,13 @@ inline bool IsValidReturnRegister(size_t regNo)
;
}

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

Expand Down
2 changes: 1 addition & 1 deletion src/vm/threadsuspend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7286,7 +7286,7 @@ ReturnKind GetReturnKind(Thread *pThread, EECodeInfo *codeInfo)
if (gcInfoToken.IsReturnKindAvailable())
{
GcInfoDecoder gcInfoDecoder(gcInfoToken, DECODE_RETURN_KIND);
ReturnKind returnKind = gcInfoDecoder.GetReturnKind();
returnKind = gcInfoDecoder.GetReturnKind();
}
#endif // _TARGET_X86_

Expand Down

0 comments on commit dc52f8b

Please sign in to comment.