Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for delegate GDV and method-based vtable GDV #68703

Merged
merged 73 commits into from
Jun 17, 2022
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
26ad0a8
Add support for storing method handle histograms in profiles
jakobbotsch Apr 12, 2022
6959656
Fix R2R reader for PGO schema entries without data
jakobbotsch Apr 12, 2022
3245442
Support instrumenting method handles for delegates and vtable calls
jakobbotsch Apr 13, 2022
2cbe83f
Handle static methods and also move fcall handling
jakobbotsch Apr 14, 2022
5b31bee
Fix writing out methods
jakobbotsch Apr 14, 2022
7596146
Remove an unnecessary check
jakobbotsch Apr 15, 2022
a1c3a7e
Merge remote-tracking branch 'upstream/main' into method-handle-histo…
jakobbotsch Apr 15, 2022
5114f2c
Fix build and some logic inversions
jakobbotsch Apr 15, 2022
decb84d
Bump R2R minor version and JIT-EE GUID
jakobbotsch Apr 18, 2022
baf3662
Merge remote-tracking branch 'upstream/main' into method-handle-histo…
jakobbotsch Apr 18, 2022
8703a49
Merge remote-tracking branch 'upstream/main' into method-handle-instr…
jakobbotsch Apr 25, 2022
7b1714a
Merge branch 'method-handle-histograms' into method-handle-instrument…
jakobbotsch Apr 25, 2022
7910dba
Merge remote-tracking branch 'origin/method-handle-histograms' into m…
jakobbotsch Apr 25, 2022
01353ed
Fix after merge
jakobbotsch Apr 25, 2022
a3b04a3
Change to static_assert and remove a comment
jakobbotsch Apr 28, 2022
8dc5c6a
Foo
jakobbotsch Apr 29, 2022
da05869
Few cleanups
jakobbotsch Apr 29, 2022
af7232b
Better comment
jakobbotsch Apr 29, 2022
12d1d86
Run jit-format
jakobbotsch Apr 29, 2022
5a09741
More cleanup
jakobbotsch Apr 29, 2022
cd07709
Do not null check delegate GDV calls
jakobbotsch Apr 29, 2022
8456a11
Avoid devirt for probed calls
jakobbotsch Apr 29, 2022
e401711
Cleanup and format
jakobbotsch Apr 30, 2022
7bc4374
Fix 32-bit build
jakobbotsch Apr 30, 2022
5ee82e2
Reuse target from temp in cold call
jakobbotsch May 2, 2022
7250abe
Merge branch 'main' of github.com:dotnet/runtime into method-handle-i…
jakobbotsch May 4, 2022
98671fc
Merge branch 'main' of github.com:dotnet/runtime into method-handle-i…
jakobbotsch May 17, 2022
b175511
Fix build
jakobbotsch May 18, 2022
95af330
Add MethodProfiling PGO scenarios
jakobbotsch May 18, 2022
fa01664
Support randomized GDVs for method handle histograms
jakobbotsch May 18, 2022
7a5386e
Run jit-format
jakobbotsch May 18, 2022
f1bb0da
Merge branch 'main' of github.com:dotnet/runtime into method-handle-i…
jakobbotsch May 23, 2022
edd2db7
Fix an asertion failure
jakobbotsch May 23, 2022
e4093c9
Make sure we only log in DEBUG
jakobbotsch May 23, 2022
2c1ebe3
Avoid GDV for static calls
jakobbotsch May 23, 2022
fbbac89
Fix interaction with chained GDV
jakobbotsch May 23, 2022
d622b64
Fix cast helper probes
jakobbotsch May 23, 2022
8ce47f8
Run jit-format
jakobbotsch May 23, 2022
39ac90a
Pick random GDV after logging histogram
jakobbotsch May 24, 2022
0ab00ae
Fix GDV for vtable calls on System.Delegate
jakobbotsch May 24, 2022
93efde4
Mark early expanded vtable calls as such
jakobbotsch May 24, 2022
8a7ec55
Merge branch 'main' of github.com:dotnet/runtime into method-handle-i…
jakobbotsch May 24, 2022
4b44c8d
Pull reservoir index calculation up in profile helpers
jakobbotsch May 24, 2022
c30a951
Record only delegate cases that we can actually GDV for
jakobbotsch May 25, 2022
531ac9d
Merge branch 'main' of github.com:dotnet/runtime into method-handle-i…
jakobbotsch May 27, 2022
f6e0827
Fix pesky x86 GTF_CALL_POP_ARGS bug
jakobbotsch May 27, 2022
27aff20
Exclude dynamic methods as well as methods in collectible ALCs
jakobbotsch May 27, 2022
8444cee
Remove excessive JIT-EE calls for debug logging in non-verbose
jakobbotsch May 27, 2022
cbc494b
Increase some timeouts to get a full test run
jakobbotsch Jun 2, 2022
6beca6a
Merge branch 'main' of github.com:dotnet/runtime into method-handle-i…
jakobbotsch Jun 2, 2022
0937004
Add missing helper in CorInfoHelpFunc.cs
jakobbotsch Jun 2, 2022
56019b7
Fix conflict resolution and add profiling helpers on crossgen2 side
jakobbotsch Jun 2, 2022
1bd5203
Lower likelihood threshold to 30%, like vtable calls
jakobbotsch Jun 4, 2022
924d0b1
Revert "Increase some timeouts to get a full test run"
jakobbotsch Jun 7, 2022
dfbcc86
Add signature compatibility check
jakobbotsch Jun 7, 2022
1f7a1be
Increase some timeouts to get a full test run"
jakobbotsch Jun 7, 2022
b0a5c24
Merge branch 'main' of github.com:dotnet/runtime into method-handle-i…
jakobbotsch Jun 7, 2022
0363bf2
Fix after merge
jakobbotsch Jun 7, 2022
4201bf0
Merge branch 'main' of github.com:dotnet/runtime into method-handle-i…
jakobbotsch Jun 8, 2022
ed1a073
Separate delegate and vtable profiling
jakobbotsch Jun 8, 2022
f0010e6
Set gtTargetHandle for GDV function addrs
jakobbotsch Jun 8, 2022
2b2781d
Fix build
jakobbotsch Jun 9, 2022
993c4c2
Disable method GDV for R2R
jakobbotsch Jun 9, 2022
54b5a0b
Make extra SPMI queries for GDV debugging output purposes
jakobbotsch Jun 10, 2022
901d4d1
Reorder static and signature check
jakobbotsch Jun 10, 2022
12f3654
Misc changes
jakobbotsch Jun 10, 2022
6a9fbfe
Enable delegate profiling by default
jakobbotsch Jun 10, 2022
c46ebaa
Fix newlines when printing test profile
jakobbotsch Jun 14, 2022
2fad8de
Merge branch 'main' of github.com:dotnet/runtime into method-handle-i…
jakobbotsch Jun 15, 2022
60f140e
Add GetLikelyMethod and hook it up through R2R
jakobbotsch Jun 15, 2022
1bfc4d8
Update JIT-EE GUID
jakobbotsch Jun 15, 2022
55cdf81
Address some feedback, remove some unneeded stuff
jakobbotsch Jun 16, 2022
55c9d54
Address some more feedback
jakobbotsch Jun 16, 2022
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
3 changes: 3 additions & 0 deletions src/coreclr/inc/corinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,9 @@ enum CorInfoHelpFunc
CORINFO_HELP_VALIDATE_INDIRECT_CALL, // CFG: Validate function pointer
CORINFO_HELP_DISPATCH_INDIRECT_CALL, // CFG: Validate and dispatch to pointer

CORINFO_HELP_METHODPROFILE32, // Update 32-bit method profile for a call site
CORINFO_HELP_METHODPROFILE64, // Update 64-bit method profile for a call site

CORINFO_HELP_COUNT,
};

Expand Down
33 changes: 19 additions & 14 deletions src/coreclr/inc/corjit.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,8 @@ class ICorJitInfo : public ICorDynamicInfo

// Data structure for a single class probe using 32-bit count.
//
// CLASS_FLAG and INTERFACE_FLAG are placed into the Other field in the schema
// CLASS_FLAG, INTERFACE_FLAG and DELEGATE_FLAG are placed into the Other field in the schema.
// If CLASS_FLAG is set the handle table consists of type handles, and otherwise method handles.
//
// Count is the number of times a call was made at that call site.
//
Expand All @@ -339,24 +340,25 @@ class ICorJitInfo : public ICorDynamicInfo
// SAMPLE_INTERVAL must be >= SIZE. SAMPLE_INTERVAL / SIZE
// gives the average number of calls between table updates.
//
struct ClassProfile32
struct HandleHistogram32
{
enum {
SIZE = 8,
SAMPLE_INTERVAL = 32,
CLASS_FLAG = 0x80000000,
INTERFACE_FLAG = 0x40000000,
OFFSET_MASK = 0x3FFFFFFF
DELEGATE_FLAG = 0x20000000,
OFFSET_MASK = 0x0FFFFFFF
};

uint32_t Count;
CORINFO_CLASS_HANDLE ClassTable[SIZE];
void* HandleTable[SIZE];
};

struct ClassProfile64
struct HandleHistogram64
{
uint64_t Count;
CORINFO_CLASS_HANDLE ClassTable[ClassProfile32::SIZE];
void* HandleTable[HandleHistogram32::SIZE];
};

enum class PgoInstrumentationKind
Expand All @@ -368,6 +370,7 @@ class ICorJitInfo : public ICorDynamicInfo
FourByte = 1,
EightByte = 2,
TypeHandle = 3,
MethodHandle = 4,

// Mask of all schema data types
MarshalMask = 0xF,
Expand All @@ -385,14 +388,16 @@ class ICorJitInfo : public ICorDynamicInfo
Done = None, // All instrumentation schemas must end with a record which is "Done"
BasicBlockIntCount = (DescriptorMin * 1) | FourByte, // basic block counter using unsigned 4 byte int
BasicBlockLongCount = (DescriptorMin * 1) | EightByte, // basic block counter using unsigned 8 byte int
TypeHandleHistogramIntCount = (DescriptorMin * 2) | FourByte | AlignPointer, // 4 byte counter that is part of a type histogram. Aligned to match ClassProfile32's alignment.
TypeHandleHistogramLongCount = (DescriptorMin * 2) | EightByte, // 8 byte counter that is part of a type histogram
TypeHandleHistogramTypeHandle = (DescriptorMin * 3) | TypeHandle, // TypeHandle that is part of a type histogram
HandleHistogramIntCount = (DescriptorMin * 2) | FourByte | AlignPointer, // 4 byte counter that is part of a type histogram. Aligned to match HandleHistogram32's alignment.
HandleHistogramLongCount = (DescriptorMin * 2) | EightByte, // 8 byte counter that is part of a type histogram
HandleHistogramTypes = (DescriptorMin * 3) | TypeHandle, // Histogram of type handles
HandleHistogramMethods = (DescriptorMin * 3) | MethodHandle, // Histogram of method handles
Version = (DescriptorMin * 4) | None, // Version is encoded in the Other field of the schema
NumRuns = (DescriptorMin * 5) | None, // Number of runs is encoded in the Other field of the schema
EdgeIntCount = (DescriptorMin * 6) | FourByte, // edge counter using unsigned 4 byte int
EdgeLongCount = (DescriptorMin * 6) | EightByte, // edge counter using unsigned 8 byte int
GetLikelyClass = (DescriptorMin * 7) | TypeHandle, // Compressed get likely class data
GetLikelyMethod = (DescriptorMin * 7) | MethodHandle, // Compressed get likely method data
};

struct PgoInstrumentationSchema
Expand All @@ -415,13 +420,13 @@ class ICorJitInfo : public ICorDynamicInfo
Sampling= 6, // PGO data derived from sampling
};

#define DEFAULT_UNKNOWN_TYPEHANDLE 1
#define UNKNOWN_TYPEHANDLE_MIN 1
#define UNKNOWN_TYPEHANDLE_MAX 33
#define DEFAULT_UNKNOWN_HANDLE 1
#define UNKNOWN_HANDLE_MIN 1
#define UNKNOWN_HANDLE_MAX 33

static inline bool IsUnknownTypeHandle(intptr_t typeHandle)
static inline bool IsUnknownHandle(intptr_t handle)
{
return ((typeHandle >= UNKNOWN_TYPEHANDLE_MIN) && (typeHandle <= UNKNOWN_TYPEHANDLE_MAX));
return ((handle >= UNKNOWN_HANDLE_MIN) && (handle <= UNKNOWN_HANDLE_MAX));
}

// get profile information to be used for optimizing a current method. The format
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/inc/eventtracebase.h
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ namespace ETW
static VOID MethodRestored(MethodDesc * pMethodDesc);
static VOID MethodTableRestored(MethodTable * pMethodTable);
static VOID DynamicMethodDestroyed(MethodDesc *pMethodDesc);
static VOID LogMethodInstrumentationData(MethodDesc* method, uint32_t cbData, BYTE *data, TypeHandle* pTypeHandles, uint32_t typeHandles);
static VOID LogMethodInstrumentationData(MethodDesc* method, uint32_t cbData, BYTE *data, TypeHandle* pTypeHandles, uint32_t numTypeHandles, MethodDesc** pMethods, uint32_t numMethods);
#else // FEATURE_EVENT_TRACE
public:
static VOID GetR2RGetEntryPointStart(MethodDesc *pMethodDesc) {};
Expand All @@ -951,7 +951,7 @@ namespace ETW
static VOID MethodRestored(MethodDesc * pMethodDesc) {};
static VOID MethodTableRestored(MethodTable * pMethodTable) {};
static VOID DynamicMethodDestroyed(MethodDesc *pMethodDesc) {};
static VOID LogMethodInstrumentationData(MethodDesc* method, uint32_t cbData, BYTE *data, TypeHandle* pTypeHandles, uint32_t typeHandles) {};
static VOID LogMethodInstrumentationData(MethodDesc* method, uint32_t cbData, BYTE *data, TypeHandle* pTypeHandles, uint32_t numTypeHandles, MethodDesc** pMethods, uint32_t numMethods) {};
#endif // FEATURE_EVENT_TRACE
};

Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/inc/jiteeversionguid.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ typedef const GUID *LPCGUID;
#define GUID_DEFINED
#endif // !GUID_DEFINED

constexpr GUID JITEEVersionIdentifier = { /* b0719856-6fe6-407c-bf40-7a57e22b2382 */
0xb0719856,
0x6fe6,
0x407c,
{0xbf, 0x40, 0x7a, 0x57, 0xe2, 0x2b, 0x23, 0x82}
constexpr GUID JITEEVersionIdentifier = { /* 7503fe09-4852-40f6-829a-ff91402c9604 */
0x7503fe09,
0x4852,
0x40f6,
{0x82, 0x9a, 0xff, 0x91, 0x40, 0x2c, 0x96, 0x04}
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/inc/jithelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,9 @@
JITHELPER(CORINFO_HELP_DISPATCH_INDIRECT_CALL, NULL, CORINFO_HELP_SIG_REG_ONLY)
#endif

JITHELPER(CORINFO_HELP_METHODPROFILE32, JIT_MethodProfile32, CORINFO_HELP_SIG_8_STACK)
JITHELPER(CORINFO_HELP_METHODPROFILE64, JIT_MethodProfile64, CORINFO_HELP_SIG_8_STACK)

#undef JITHELPER
#undef DYNAMICJITHELPER
#undef JITHELPER
Expand Down
41 changes: 29 additions & 12 deletions src/coreclr/inc/pgo_formatprocessing.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,7 @@

#ifdef FEATURE_PGO

inline bool AddTypeHandleToUnknownTypeHandleMask(INT_PTR typeHandle, uint32_t *unknownTypeHandleMask)
{
uint32_t bitMask = (uint32_t)(1 << (typeHandle - UNKNOWN_TYPEHANDLE_MIN));
bool result = (bitMask & *unknownTypeHandleMask) == 0;
*unknownTypeHandleMask |= bitMask;
return result;
}

inline INT_PTR HashToPgoUnknownTypeHandle(uint32_t hash)
inline INT_PTR HashToPgoUnknownHandle(uint32_t hash)
{
// Map from a 32bit hash to the 32 different unknown type handle values
return (hash & 0x1F) + 1;
Expand Down Expand Up @@ -53,6 +45,7 @@ inline uint32_t InstrumentationKindToSize(ICorJitInfo::PgoInstrumentationKind ki
case ICorJitInfo::PgoInstrumentationKind::EightByte:
return 8;
case ICorJitInfo::PgoInstrumentationKind::TypeHandle:
case ICorJitInfo::PgoInstrumentationKind::MethodHandle:
return TARGET_POINTER_SIZE;
default:
_ASSERTE(FALSE);
Expand Down Expand Up @@ -242,6 +235,7 @@ bool ReadInstrumentationData(const uint8_t *pByte, size_t cbDataMax, SchemaAndDa
bool done = false;
int64_t lastDataValue = 0;
int64_t lastTypeDataValue = 0;
int64_t lastMethodDataValue = 0;
int32_t dataCountToRead = 0;

ReadCompressedInts(pByte, cbDataMax, [&](int64_t curValue)
Expand All @@ -267,8 +261,16 @@ bool ReadInstrumentationData(const uint8_t *pByte, size_t cbDataMax, SchemaAndDa
return false;
}
break;
case ICorJitInfo::PgoInstrumentationKind::MethodHandle:
lastMethodDataValue += curValue;

if (!handler(schemaHandler.GetSchema(), lastMethodDataValue, schemaHandler.GetSchema().Count - dataCountToRead))
{
return false;
}
break;
default:
assert(false);
assert(!"Unexpected PGO instrumentation data type");
break;
}
dataCountToRead--;
Expand Down Expand Up @@ -516,6 +518,7 @@ class SchemaAndDataWriter
ICorJitInfo::PgoInstrumentationSchema prevSchema = {};
int64_t lastIntDataWritten = 0;
int64_t lastTypeDataWritten = 0;
int64_t lastMethodDataWritten = 0;

public:
SchemaAndDataWriter(const ByteWriter& byteWriter, uint8_t* pInstrumentationData) :
Expand All @@ -532,8 +535,8 @@ class SchemaAndDataWriter
return true;
}

template<class TypeHandleProcessor>
bool AppendDataFromLastSchema(TypeHandleProcessor& thProcessor)
template<class TypeHandleProcessor, class MethodHandleProcessor>
bool AppendDataFromLastSchema(TypeHandleProcessor& thProcessor, MethodHandleProcessor& mhProcessor)
{
uint8_t *pData = (pInstrumentationData + prevSchema.Offset);
for (int32_t iDataElem = 0; iDataElem < prevSchema.Count; iDataElem++)
Expand Down Expand Up @@ -577,6 +580,20 @@ class SchemaAndDataWriter
pData += sizeof(intptr_t);
break;
}
case ICorJitInfo::PgoInstrumentationKind::MethodHandle:
{
logicalDataToWrite = *(volatile intptr_t*)pData;

// As there could be tearing otherwise, inform the caller of exactly what value was written.
mhProcessor(logicalDataToWrite);

bool returnValue = WriteCompressedIntToBytes(logicalDataToWrite - lastMethodDataWritten, byteWriter);
lastMethodDataWritten = logicalDataToWrite;
if (!returnValue)
return false;
pData += sizeof(intptr_t);
break;
}
default:
_ASSERTE(!"Unexpected type");
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/inc/readytorun.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

// Keep these in sync with src/coreclr/tools/Common/Internal/Runtime/ModuleHeaders.cs
#define READYTORUN_MAJOR_VERSION 0x0006
#define READYTORUN_MINOR_VERSION 0x0000
#define READYTORUN_MINOR_VERSION 0x0001

#define MINIMUM_READYTORUN_MAJOR_VERSION 0x006

Expand Down
8 changes: 4 additions & 4 deletions src/coreclr/jit/block.h
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ enum BasicBlockFlags : unsigned __int64
BBF_BACKWARD_JUMP_TARGET = MAKE_BBFLAG(35), // Block is a target of a backward jump

BBF_PATCHPOINT = MAKE_BBFLAG(36), // Block is a patchpoint
BBF_HAS_CLASS_PROFILE = MAKE_BBFLAG(37), // BB contains a call needing a class profile
BBF_HAS_HISTOGRAM_PROFILE = MAKE_BBFLAG(37), // BB contains a call needing a class profile
jakobbotsch marked this conversation as resolved.
Show resolved Hide resolved
BBF_PARTIAL_COMPILATION_PATCHPOINT = MAKE_BBFLAG(38), // Block is a partial compilation patchpoint
BBF_HAS_ALIGN = MAKE_BBFLAG(39), // BB ends with 'align' instruction
BBF_TAILCALL_SUCCESSOR = MAKE_BBFLAG(40), // BB has pred that has potential tail call
Expand Down Expand Up @@ -582,7 +582,7 @@ enum BasicBlockFlags : unsigned __int64
// TODO: Should BBF_RUN_RARELY be added to BBF_SPLIT_GAINED ?

BBF_SPLIT_GAINED = BBF_DONT_REMOVE | BBF_HAS_JMP | BBF_BACKWARD_JUMP | BBF_HAS_IDX_LEN | BBF_HAS_NEWARRAY | BBF_PROF_WEIGHT | \
BBF_HAS_NEWOBJ | BBF_KEEP_BBJ_ALWAYS | BBF_CLONED_FINALLY_END | BBF_HAS_NULLCHECK | BBF_HAS_CLASS_PROFILE,
BBF_HAS_NEWOBJ | BBF_KEEP_BBJ_ALWAYS | BBF_CLONED_FINALLY_END | BBF_HAS_NULLCHECK | BBF_HAS_HISTOGRAM_PROFILE,
};

inline constexpr BasicBlockFlags operator ~(BasicBlockFlags a)
Expand Down Expand Up @@ -918,8 +918,8 @@ struct BasicBlock : private LIR::Range
};

union {
unsigned bbStkTempsOut; // base# for output stack temps
int bbClassSchemaIndex; // schema index for class instrumentation
unsigned bbStkTempsOut; // base# for output stack temps
int bbHistogramSchemaIndex; // schema index for histogram instrumentation
};

#define MAX_XCPTN_INDEX (USHRT_MAX - 1)
Expand Down
8 changes: 4 additions & 4 deletions src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6232,10 +6232,10 @@ int Compiler::compCompileHelper(CORINFO_MODULE_HANDLE classPtr,
compHndBBtabCount = 0;
compHndBBtabAllocCount = 0;

info.compNativeCodeSize = 0;
info.compTotalHotCodeSize = 0;
info.compTotalColdCodeSize = 0;
info.compClassProbeCount = 0;
info.compNativeCodeSize = 0;
info.compTotalHotCodeSize = 0;
info.compTotalColdCodeSize = 0;
info.compHandleHistogramProbeCount = 0;

compHasBackwardJump = false;
compHasBackwardJumpInHandler = false;
Expand Down
36 changes: 30 additions & 6 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -1814,6 +1814,7 @@ class Compiler
friend class MorphInitBlockHelper;
friend class MorphCopyBlockHelper;
friend class CallArgs;
friend class IndirectCallTransformer;

#ifdef FEATURE_HW_INTRINSICS
friend struct HWIntrinsicInfo;
Expand Down Expand Up @@ -2317,8 +2318,12 @@ class Compiler

GenTreeCall* gtNewIndCallNode(GenTree* addr, var_types type, const DebugInfo& di = DebugInfo());

GenTreeCall* gtNewHelperCallNode(
unsigned helper, var_types type, GenTree* arg1 = nullptr, GenTree* arg2 = nullptr, GenTree* arg3 = nullptr);
GenTreeCall* gtNewHelperCallNode(unsigned helper,
var_types type,
GenTree* arg1 = nullptr,
GenTree* arg2 = nullptr,
GenTree* arg3 = nullptr,
GenTree* arg4 = nullptr);

GenTreeCall* gtNewRuntimeLookupHelperCallNode(CORINFO_RUNTIME_LOOKUP* pRuntimeLookup,
GenTree* ctxTree,
Expand Down Expand Up @@ -3518,6 +3523,18 @@ class Compiler
bool isExplicitTailCall,
IL_OFFSET ilOffset = BAD_IL_OFFSET);

void impConsiderCallProbe(GenTreeCall* call, IL_OFFSET ilOffset);

enum class GDVProbeType
{
None,
ClassProfile,
MethodProfile,
MethodAndClassProfile,
};

GDVProbeType compClassifyGDVProbeType(GenTreeCall* call);

//=========================================================================
// PROTECTED
//=========================================================================
Expand Down Expand Up @@ -5415,7 +5432,7 @@ class Compiler
bool fgGetProfileWeightForBasicBlock(IL_OFFSET offset, weight_t* weight);

Instrumentor* fgCountInstrumentor;
Instrumentor* fgClassInstrumentor;
Instrumentor* fgHistogramInstrumentor;

PhaseStatus fgPrepareToInstrumentMethod();
PhaseStatus fgInstrumentMethod();
Expand All @@ -5441,6 +5458,7 @@ class Compiler
UINT32 fgPgoBlockCounts;
UINT32 fgPgoEdgeCounts;
UINT32 fgPgoClassProfiles;
UINT32 fgPgoMethodProfiles;
unsigned fgPgoInlineePgo;
unsigned fgPgoInlineeNoPgo;
unsigned fgPgoInlineeNoPgoSingleBlock;
Expand Down Expand Up @@ -5658,6 +5676,7 @@ class Compiler
Statement* paramAssignmentInsertionPoint);
GenTree* fgMorphCall(GenTreeCall* call);
GenTree* fgExpandVirtualVtableCallTarget(GenTreeCall* call);

void fgMorphCallInline(GenTreeCall* call, InlineResult* result);
void fgMorphCallInlineHelper(GenTreeCall* call, InlineResult* result, InlineContext** createdContext);
#if DEBUG
Expand Down Expand Up @@ -6781,13 +6800,18 @@ class Compiler
optMethodFlags &= ~OMF_HAS_GUARDEDDEVIRT;
}

void pickGDV(GenTreeCall* call,
IL_OFFSET ilOffset,
bool isInterface,
CORINFO_CLASS_HANDLE* classGuess,
CORINFO_METHOD_HANDLE* methodGuess,
unsigned* likelihood);
void considerGuardedDevirtualization(GenTreeCall* call,
IL_OFFSET ilOffset,
bool isInterface,
CORINFO_METHOD_HANDLE baseMethod,
CORINFO_CLASS_HANDLE baseClass,
CORINFO_CONTEXT_HANDLE* pContextHandle DEBUGARG(CORINFO_CLASS_HANDLE objClass)
DEBUGARG(const char* objClassName));
CORINFO_CONTEXT_HANDLE* pContextHandle);

void addGuardedDevirtualizationCandidate(GenTreeCall* call,
CORINFO_METHOD_HANDLE methodHandle,
Expand Down Expand Up @@ -9488,7 +9512,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
unsigned genCPU; // What CPU are we running on

// Number of class profile probes in this method
unsigned compClassProbeCount;
unsigned compHandleHistogramProbeCount;

} info;

Expand Down
Loading