Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions src/coreclr/jit/gcencode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include "gcinfotypes.h"
#include "patchpointinfo.h"

#ifdef JIT32_GCENCODER

ReturnKind VarTypeToReturnKind(var_types type)
{
switch (type)
Expand All @@ -29,40 +31,38 @@ ReturnKind VarTypeToReturnKind(var_types type)
return RT_Object;
case TYP_BYREF:
return RT_ByRef;
#ifdef TARGET_X86
case TYP_FLOAT:
case TYP_DOUBLE:
return RT_Float;
#endif // TARGET_X86
default:
return RT_Scalar;
}
}

ReturnKind GCInfo::getReturnKind()
{
// Note the GCInfo representation only supports structs with up to 2 GC pointers.
// Note the JIT32 GCInfo representation only supports structs with 1 GC pointer.
ReturnTypeDesc retTypeDesc = compiler->compRetTypeDesc;
const unsigned regCount = retTypeDesc.GetReturnRegCount();

switch (regCount)
if (regCount == 1)
{
return VarTypeToReturnKind(retTypeDesc.GetReturnRegType(0));
}
else
{
case 1:
return VarTypeToReturnKind(retTypeDesc.GetReturnRegType(0));
case 2:
return GetStructReturnKind(VarTypeToReturnKind(retTypeDesc.GetReturnRegType(0)),
VarTypeToReturnKind(retTypeDesc.GetReturnRegType(1)));
default:
#ifdef DEBUG
for (unsigned i = 0; i < regCount; i++)
{
assert(!varTypeIsGC(retTypeDesc.GetReturnRegType(i)));
}
for (unsigned i = 0; i < regCount; i++)
{
assert(!varTypeIsGC(retTypeDesc.GetReturnRegType(i)));
}
#endif // DEBUG
return RT_Scalar;
return RT_Scalar;
}
}

#endif // JIT32_GCENCODER

// gcMarkFilterVarsPinned - Walk all lifetimes and make it so that anything
// live in a filter is marked as pinned (often by splitting the lifetime
// so that *only* the filter region is pinned). This should only be
Expand Down
5 changes: 2 additions & 3 deletions src/coreclr/jit/jitgcinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,8 @@ class GCInfo

private:
static size_t gcRecordEpilog(void* pCallBackData, unsigned offset);

ReturnKind getReturnKind();
#else // JIT32_GCENCODER
void gcInfoBlockHdrSave(GcInfoEncoder* gcInfoEncoder, unsigned methodSize, unsigned prologSize);

Expand Down Expand Up @@ -398,9 +400,6 @@ class GCInfo
public:
// This method updates the appropriate reg masks when a variable is moved.
void gcUpdateForRegVarMove(regMaskTP srcMask, regMaskTP dstMask, LclVarDsc* varDsc);

private:
ReturnKind getReturnKind();
};

inline unsigned char encodeUnsigned(BYTE* dest, unsigned value)
Expand Down
9 changes: 9 additions & 0 deletions src/coreclr/vm/method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1299,6 +1299,15 @@ ReturnKind MethodDesc::ParseReturnKindFromSig(INDEBUG(bool supportStringConstruc
regKinds[i] = RT_Scalar;
}
}

if (eeClass->GetEightByteClassification(0) == SystemVClassificationTypeSSE)
{
// Skip over SSE types since they do not consume integer registers.
// An obj/byref in the 2nd eight bytes will be in the first integer register.
regKinds[0] = regKinds[1];
regKinds[1] = RT_Scalar;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can ParseReturnKindFromSig be simplified too? It is only used by MethodDesc::GetReturnKind and that one has only uses from GCStress (which is under TARGET_X86) and CLRToCOMMethodFrame::GcScanRoots_Impl (which does not try to handle the multireg cases, but with a NYI assert.).

The ReturnKind enum could probably be cleaned up too after that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ReturnKind enum could probably be cleaned up too after that.

GCInfo decoder source is shared with diagnostic repo. It needs to support older versions of the format. The no longer used ReturnKind values need to stay for that.

Can ParseReturnKindFromSig be simplified too?

Done


ReturnKind structReturnKind = GetStructReturnKind(regKinds[0], regKinds[1]);
return structReturnKind;
}
Expand Down