Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
24 changes: 19 additions & 5 deletions src/coreclr/jit/gcencode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2124,21 +2124,35 @@ unsigned PendingArgsStack::pasEnumGCoffs(unsigned iter, unsigned* offs)
// when reporting interruptible ranges.
class NoGCRegionEncoder
{
BYTE* dest;
BYTE* dest;
unsigned lastSize = 0;
unsigned lastEndOffs = -1;
public:
size_t totalSize;
size_t totalSize = 0;

NoGCRegionEncoder(BYTE* dest)
: dest(dest)
, totalSize(0)
{
}

// This callback is called for each insGroup marked with IGF_NOGCINTERRUPT.
bool operator()(unsigned igFuncIdx, unsigned igOffs, unsigned igSize, unsigned firstInstrSize, bool isInProlog)
{
totalSize += encodeUnsigned(dest == NULL ? NULL : dest + totalSize, igOffs);
totalSize += encodeUnsigned(dest == NULL ? NULL : dest + totalSize, igSize);
unsigned size;
Comment thread
SingleAccretion marked this conversation as resolved.
if (igOffs == lastEndOffs) // Coalesce adjacent intervals by re-encoding the enlarged size.
{
totalSize -= encodeUnsigned(nullptr, lastSize);
size = lastSize + igSize;
}
else
{
totalSize += encodeUnsigned(dest == nullptr ? nullptr : dest + totalSize, igOffs);
size = igSize;
}
totalSize += encodeUnsigned(dest == nullptr ? nullptr : dest + totalSize, size);

lastSize = size;
lastEndOffs = igOffs + igSize;
return true;
}
};
Expand Down
7 changes: 6 additions & 1 deletion src/coreclr/jit/gcinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ GCInfo::regPtrDsc* GCInfo::gcRegPtrAllocDsc()
struct NoGCRegionCounter
{
unsigned noGCRegionCount;
unsigned lastEndOffs = -1;

NoGCRegionCounter()
: noGCRegionCount(0)
Expand All @@ -425,7 +426,11 @@ struct NoGCRegionCounter
// This callback is called for each insGroup marked with IGF_NOGCINTERRUPT.
bool operator()(unsigned igFuncIdx, unsigned igOffs, unsigned igSize, unsigned firstInstrSize, bool isInProlog)
{
noGCRegionCount++;
if (lastEndOffs != igOffs)
{
noGCRegionCount++;
}
lastEndOffs = igOffs + igSize;
return true;
}
};
Expand Down
Loading