diff options
author | David Wrighton <davidwr@microsoft.com> | 2021-04-16 21:49:56 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-16 21:49:56 +0300 |
commit | 2810ae5ff692108291692dec5ac36ba698af887b (patch) | |
tree | 7d14875e50cf186036b2715342f58b4d073b93f9 /src/coreclr/inc | |
parent | 33033b22eccf50550451387ac8927ad1b5f17768 (diff) |
Improve likely class handling for pgo (#51284)
- Move processing of likely class histogram into the JIT
- Fix cases where the devirtualization logic in crossgen2 behaved incorrectly in the presence of likely class histogram data
- Pre-process histogram at crossgen2 time to reduce the size of the pgo data
- This removes 3/4 of the data from System.Private.CoreLib
Diffstat (limited to 'src/coreclr/inc')
-rw-r--r-- | src/coreclr/inc/corjit.h | 28 | ||||
-rw-r--r-- | src/coreclr/inc/icorjitinfoimpl_generated.h | 7 | ||||
-rw-r--r-- | src/coreclr/inc/jiteeversionguid.h | 10 | ||||
-rw-r--r-- | src/coreclr/inc/pgo_formatprocessing.h | 9 |
4 files changed, 15 insertions, 39 deletions
diff --git a/src/coreclr/inc/corjit.h b/src/coreclr/inc/corjit.h index 85cb80bc370..2407a407ac5 100644 --- a/src/coreclr/inc/corjit.h +++ b/src/coreclr/inc/corjit.h @@ -363,6 +363,7 @@ public: 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, // 4 byte edge counter, using unsigned 4 byte int + GetLikelyClass = (DescriptorMin * 7) | TypeHandle, // Compressed get likely class data }; struct PgoInstrumentationSchema @@ -374,6 +375,15 @@ public: int32_t Other; }; +#define DEFAULT_UNKNOWN_TYPEHANDLE 1 +#define UNKNOWN_TYPEHANDLE_MIN 1 +#define UNKNOWN_TYPEHANDLE_MAX 33 + + static inline bool IsUnknownTypeHandle(intptr_t typeHandle) + { + return ((typeHandle >= UNKNOWN_TYPEHANDLE_MIN) && (typeHandle <= UNKNOWN_TYPEHANDLE_MAX)); + } + // get profile information to be used for optimizing a current method. The format // of the buffer is the same as the format the JIT passes to allocPgoInstrumentationBySchema. virtual JITINTERFACE_HRESULT getPgoInstrumentationResults( @@ -404,24 +414,6 @@ public: uint8_t ** pInstrumentationData // OUT: `*pInstrumentationData` is set to the address of the instrumentation data. ) = 0; - // Get the likely implementing class for a virtual call or interface call made by ftnHnd - // at the indicated IL offset. baseHnd is the interface class or base class for the method - // being called. May returns NULL. - // - // pLikelihood is the estimated percent chance that the class at runtime is the class - // returned by this method. A well-estimated monomorphic call site will return a likelihood - // of 100. - // - // pNumberOfClasses is the estimated number of different classes seen at the site. - // A well-estimated monomorphic call site will return 1. - virtual CORINFO_CLASS_HANDLE getLikelyClass( - CORINFO_METHOD_HANDLE ftnHnd, - CORINFO_CLASS_HANDLE baseHnd, - uint32_t ilOffset, - uint32_t * pLikelihood, // OUT, estimated likelihood of the class (0...100) - uint32_t * pNumberOfClasses // OUT, estimated number of possible classes - ) = 0; - // Associates a native call site, identified by its offset in the native code stream, with // the signature information and method handle the JIT used to lay out the call site. If // the call site has no signature information (e.g. a helper call) or has no method handle diff --git a/src/coreclr/inc/icorjitinfoimpl_generated.h b/src/coreclr/inc/icorjitinfoimpl_generated.h index 922a854795e..8eef23aa44e 100644 --- a/src/coreclr/inc/icorjitinfoimpl_generated.h +++ b/src/coreclr/inc/icorjitinfoimpl_generated.h @@ -693,13 +693,6 @@ JITINTERFACE_HRESULT allocPgoInstrumentationBySchema( uint32_t countSchemaItems, uint8_t** pInstrumentationData) override; -CORINFO_CLASS_HANDLE getLikelyClass( - CORINFO_METHOD_HANDLE ftnHnd, - CORINFO_CLASS_HANDLE baseHnd, - uint32_t ilOffset, - uint32_t* pLikelihood, - uint32_t* pNumberOfClasses) override; - void recordCallSite( uint32_t instrOffset, CORINFO_SIG_INFO* callSig, diff --git a/src/coreclr/inc/jiteeversionguid.h b/src/coreclr/inc/jiteeversionguid.h index f76ceb70b11..b32d0edef00 100644 --- a/src/coreclr/inc/jiteeversionguid.h +++ b/src/coreclr/inc/jiteeversionguid.h @@ -43,11 +43,11 @@ typedef const GUID *LPCGUID; #define GUID_DEFINED #endif // !GUID_DEFINED -constexpr GUID JITEEVersionIdentifier = { /* a33f2f79-dd8d-49dd-b4c3-ac86f34f6a87 */ - 0xa33f2f79, - 0xdd8d, - 0x49dd, - {0xb4, 0xc3, 0xac, 0x86, 0xf3, 0x4f, 0x6a, 0x87} +constexpr GUID JITEEVersionIdentifier = { /* 12234eca-dfc2-48bc-a320-6155cf25ce17 */ + 0x12234eca, + 0xdfc2, + 0x48bc, + {0xa3, 0x20, 0x61, 0x55, 0xcf, 0x25, 0xce, 0x17} }; ////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/coreclr/inc/pgo_formatprocessing.h b/src/coreclr/inc/pgo_formatprocessing.h index 9ef06e577c3..8d111bf2c89 100644 --- a/src/coreclr/inc/pgo_formatprocessing.h +++ b/src/coreclr/inc/pgo_formatprocessing.h @@ -8,10 +8,6 @@ #ifdef FEATURE_PGO -#define DEFAULT_UNKNOWN_TYPEHANDLE 1 -#define UNKNOWN_TYPEHANDLE_MIN 1 -#define UNKNOWN_TYPEHANDLE_MAX 32 - inline bool AddTypeHandleToUnknownTypeHandleMask(INT_PTR typeHandle, uint32_t *unknownTypeHandleMask) { uint32_t bitMask = (uint32_t)(1 << (typeHandle - UNKNOWN_TYPEHANDLE_MIN)); @@ -20,11 +16,6 @@ inline bool AddTypeHandleToUnknownTypeHandleMask(INT_PTR typeHandle, uint32_t *u return result; } -inline bool IsUnknownTypeHandle(INT_PTR typeHandle) -{ - return ((typeHandle >= UNKNOWN_TYPEHANDLE_MIN) && (typeHandle <= UNKNOWN_TYPEHANDLE_MAX)); -} - inline INT_PTR HashToPgoUnknownTypeHandle(uint32_t hash) { // Map from a 32bit hash to the 32 different unknown type handle values |