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

Apply some obvious rich debug info optimizations #73373

Merged
merged 9 commits into from
Aug 6, 2022
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
11 changes: 8 additions & 3 deletions src/coreclr/inc/eventtracebase.h
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,11 @@ class CrstBase;
class BulkTypeEventLogger;
class TypeHandle;
class Thread;

template<typename ELEMENT, typename TRAITS>
class SetSHash;
template<typename ELEMENT>
class PtrSetSHashTraits;
typedef SetSHash<MethodDesc*, PtrSetSHashTraits<MethodDesc*>> MethodDescSet;

// All ETW helpers must be a part of this namespace
// We have auto-generated macros to directly fire the events
Expand Down Expand Up @@ -903,8 +907,8 @@ namespace ETW
static VOID SendEventsForNgenMethods(Module *pModule, DWORD dwEventOptions);
static VOID SendMethodJitStartEvent(MethodDesc *pMethodDesc, SString *namespaceOrClassName=NULL, SString *methodName=NULL, SString *methodSignature=NULL);
static VOID SendMethodILToNativeMapEvent(MethodDesc * pMethodDesc, DWORD dwEventOptions, PCODE pNativeCodeStartAddress, DWORD nativeCodeId, ReJITID ilCodeId);
static VOID SendMethodRichDebugInfo(MethodDesc * pMethodDesc, PCODE pNativeCodeStartAddress, DWORD nativeCodeId, ReJITID ilCodeId);
static VOID SendMethodEvent(MethodDesc *pMethodDesc, DWORD dwEventOptions, BOOL bIsJit, SString *namespaceOrClassName=NULL, SString *methodName=NULL, SString *methodSignature=NULL, PCODE pNativeCodeStartAddress = 0, PrepareCodeConfig *pConfig = NULL);
static VOID SendMethodRichDebugInfo(MethodDesc * pMethodDesc, PCODE pNativeCodeStartAddress, DWORD nativeCodeId, ReJITID ilCodeId, MethodDescSet* sentMethodDetailsSet);
static VOID SendMethodEvent(MethodDesc *pMethodDesc, DWORD dwEventOptions, BOOL bIsJit, SString *namespaceOrClassName=NULL, SString *methodName=NULL, SString *methodSignature=NULL, PCODE pNativeCodeStartAddress = 0, PrepareCodeConfig *pConfig = NULL, MethodDescSet* sentMethodDetailsSet = NULL);
static VOID SendHelperEvent(ULONGLONG ullHelperStartAddress, ULONG ulHelperSize, LPCWSTR pHelperName);
public:
typedef union _MethodStructs
Expand Down Expand Up @@ -937,6 +941,7 @@ namespace ETW
static VOID MethodJitting(MethodDesc *pMethodDesc, SString *namespaceOrClassName, SString *methodName, SString *methodSignature);
static VOID MethodJitted(MethodDesc *pMethodDesc, SString *namespaceOrClassName, SString *methodName, SString *methodSignature, PCODE pNativeCodeStartAddress, PrepareCodeConfig *pConfig);
static VOID SendMethodDetailsEvent(MethodDesc *pMethodDesc);
static VOID SendNonDuplicateMethodDetailsEvent(MethodDesc* pMethodDesc, MethodDescSet* set);
static VOID StubInitialized(ULONGLONG ullHelperStartAddress, LPCWSTR pHelperName);
static VOID StubsInitialized(PVOID *pHelperStartAddress, PVOID *pHelperNames, LONG ulNoOfHelpers);
static VOID MethodRestored(MethodDesc * pMethodDesc);
Expand Down
36 changes: 36 additions & 0 deletions src/coreclr/inc/nibblestream.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,22 @@ class NibbleWriter
WriteEncodedU32(dw);
};

void WriteUnencodedU32(uint32_t x)
{
CONTRACTL
{
THROWS;
GC_NOTRIGGER;
}
CONTRACTL_END;

for (int i = 0; i < 8; i++)
{
WriteNibble(static_cast<NIBBLE>(x & 0b1111));
x >>= 4;
}
}

protected:
NIBBLE m_PendingNibble; // Pending value, not yet written out.
bool m_fPending;
Expand Down Expand Up @@ -288,6 +304,26 @@ class NibbleReader
return (dw & 1) ? (-x) : (x);
}

DWORD ReadUnencodedU32()
{
CONTRACTL
{
THROWS;
GC_NOTRIGGER;
SUPPORTS_DAC;
}
CONTRACTL_END;

DWORD result = 0;

for (int i = 0; i < 8; i++)
{
result |= static_cast<DWORD>(ReadNibble()) << (i * 4);
}

return result;
}

protected:
PTR_BYTE m_pBuffer;
size_t m_cBytes; // size of buffer.
Expand Down
Loading