diff --git a/src/inc/eventtracebase.h b/src/inc/eventtracebase.h index d36e8101f864..453375a783c4 100644 --- a/src/inc/eventtracebase.h +++ b/src/inc/eventtracebase.h @@ -46,6 +46,16 @@ enum EtwTypeFlags kEtwTypeFlagsFinalizable = 0x2, kEtwTypeFlagsExternallyImplementedCOMObject = 0x4, kEtwTypeFlagsArray = 0x8, + kEtwTypeFlagsArrayRankBit0 = 0x100, + kEtwTypeFlagsArrayRankBit1 = 0x200, + kEtwTypeFlagsArrayRankBit2 = 0x400, + kEtwTypeFlagsArrayRankBit3 = 0x800, + kEtwTypeFlagsArrayRankBit4 = 0x1000, + kEtwTypeFlagsArrayRankBit5 = 0x2000, + + kEtwTypeFlagsArrayRankMask = 0x3F00, + kEtwTypeFlagsArrayRankShift = 8, + kEtwTypeFlagsArrayRankMax = kEtwTypeFlagsArrayRankMask >> kEtwTypeFlagsArrayRankShift }; enum EtwThreadFlags diff --git a/src/vm/ClrEtwAll.man b/src/vm/ClrEtwAll.man index 0aaa41febe21..1e82a1b5919f 100644 --- a/src/vm/ClrEtwAll.man +++ b/src/vm/ClrEtwAll.man @@ -560,6 +560,12 @@ + + + + + + @@ -7012,6 +7018,12 @@ + + + + + + diff --git a/src/vm/eventtrace.cpp b/src/vm/eventtrace.cpp index 7b6a58fd3d5c..2e73dec1397a 100644 --- a/src/vm/eventtrace.cpp +++ b/src/vm/eventtrace.cpp @@ -1778,7 +1778,20 @@ int BulkTypeEventLogger::LogSingleType(TypeHandle th) { // Normal typedesc array pVal->fixedSizedData.Flags |= kEtwTypeFlagsArray; - + if (pVal->fixedSizedData.CorElementType == ELEMENT_TYPE_ARRAY) + { + // Multidimensional arrays set the rank bits, SzArrays do not set the rank bits + unsigned rank = th.AsArray()->GetRank(); + if (rank < kEtwTypeFlagsArrayRankMax) + { + // Only ranks less than kEtwTypeFlagsArrayRankMax are supported. + // Fortunately kEtwTypeFlagsArrayRankMax should be greater than the + // number of ranks the type loader will support + rank <<= kEtwTypeFlagsArrayRankShift; + _ASSERTE((rank & kEtwTypeFlagsArrayRankMask) == rank); + pVal->fixedSizedData.Flags |= rank; + } + } // Fetch TypeHandle of array elements fSucceeded = FALSE; EX_TRY @@ -1895,10 +1908,16 @@ int BulkTypeEventLogger::LogSingleType(TypeHandle th) int cbVal = pVal->GetByteCountInEvent(); if (cbVal > kMaxBytesTypeValues) { - // This type is apparently so huge, it's too big to squeeze into an event, even - // if it were the only type batched in the whole event. Bail - _ASSERTE(!"Type too big to log via ETW"); - return -1; + pVal->sName.Clear(); + cbVal = pVal->GetByteCountInEvent(); + + if (cbVal > kMaxBytesTypeValues) + { + // This type is apparently so huge, it's too big to squeeze into an event, even + // if it were the only type batched in the whole event. Bail + _ASSERTE(!"Type too big to log via ETW"); + return -1; + } } if (m_nBulkTypeValueByteCount + cbVal > kMaxBytesTypeValues)