-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Generate rank information in BulkType events #116749
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
Conversation
Port dotnet/coreclr#27516 to native AOT.
|
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR ports support for encoding array rank information in BulkType ETW events to Native AOT.
Key changes include:
- Expose
GetParameterizedTypeShapeandGetArrayRankinMethodTable - Define new ETW type flags for array ranks in
eventtracebase.h - Update
BulkTypeEventLoggerto set rank bits for multidimensional arrays - Implement
GetArrayRanklogic inMethodTable.cpp
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/coreclr/nativeaot/Runtime/inc/MethodTable.h | Added declarations for GetParameterizedTypeShape and GetArrayRank |
| src/coreclr/nativeaot/Runtime/eventtracebase.h | Introduced enum flags/masks for array rank encoding |
| src/coreclr/nativeaot/Runtime/eventtrace_bulktype.cpp | Updated BulkType logger to set array rank bits |
| src/coreclr/nativeaot/Runtime/MethodTable.cpp | Added implementation of GetArrayRank |
Comments suppressed due to low confidence (3)
src/coreclr/nativeaot/Runtime/inc/MethodTable.h:200
- [nitpick] Add a brief doc comment explaining that this returns the raw base size used to compute element storage (including bounds for parameterized types).
uint32_t GetParameterizedTypeShape()
src/coreclr/nativeaot/Runtime/inc/MethodTable.h:217
- [nitpick] Add a doc comment describing how this computes the array rank (1 for SZ arrays, >1 for multidimensional).
uint32_t GetArrayRank();
src/coreclr/nativeaot/Runtime/eventtrace_bulktype.cpp:305
- Add unit or integration tests to cover multidimensional array ranks being encoded correctly in
BulkTypeEventLogger, especially for ranks >1.
uint32_t rank = pEEType->GetArrayRank();
| ASSERT(IsArray()); | ||
| uint32_t boundsSize = GetParameterizedTypeShape() - SZARRAY_BASE_SIZE; | ||
| if (boundsSize > 0) | ||
| { |
Copilot
AI
Jun 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an ASSERT to verify that boundsSize % (2 * sizeof(uint32_t)) == 0 to catch unexpected shape values and ensure the division yields an integer dimension count.
| { | |
| { | |
| // Ensure boundsSize is divisible by (2 * sizeof(uint32_t)). | |
| ASSERT(boundsSize % (2 * sizeof(uint32_t)) == 0); |
|
/ba-g the HostActivation failure is likely #116520 and unrelated |
Port dotnet/coreclr#27516 to native AOT.
Cc @dotnet/ilc-contrib