-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Fix handling of multidimensional arrays in type system and dotnet-pgo #51764
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
Fix handling of multidimensional arrays in type system and dotnet-pgo #51764
Conversation
- Provide representation for multidimensional array non-standard shapes in embedded signature data (to allow overloads) - This fixes possible issues in interop with C++ and IL generated binaries in crossgen2 as well as these issues in dotnet-pgo - Move type system metadata emitter logic from dotnet-pgo source base to common - Enables creation of unittests to cover the bugs identified - Fix emission of multidimensional arrays in signature emitter - Emit complex array shape when available - Even when standard shape is in place, pass empty ImmutableArrays for bounds and lobounds, not just default - Fix handling of multidimensional arrays when generating a type reference - If a type isn't a MetadataType don't treat it as one Also a small drive-by fix to reduce unnecessary throwing of exceptions while running dotnet-pgo
@dotnet/crossgen-contrib |
@Lxiamail Alicia, when this gets in we should be able to enable the Orchard optimization scenario |
loBounds[i] = Int32.Parse(loBoundsStr[i]); | ||
} | ||
|
||
shapeEncoder.Shape(rank, ImmutableArray.Create(bounds), ImmutableArray.Create(loBounds)); |
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.
Nit - would it be useful to add assertions checking the bounds / lower bounds length against the array rank?
@@ -472,7 +517,6 @@ void EncodeMethodSignature(BlobBuilder signatureBuilder, MethodSignature sig, Em | |||
|
|||
signatureEncoder.MethodSignature(sigCallingConvention, genericParameterCount, isInstanceMethod); | |||
signatureBuilder.WriteCompressedInteger(sig.Length); | |||
// TODO Process custom modifiers in some way |
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.
Just for my education - does deletion of this comment mean that this has been fixed independently or that we no longer care about custom modifiers?
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.
We already wrote the code to handle custom modifiers a year or so ago, but never actually cleaned up this comment.
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.
In particular that's what the embedded signature data stuff was written for originally. I will say that it is completely and totally incomprehensible as Michal has noted before, but it does work. And with handling of array shapes we hopefully won't ever have to touch it again.
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.
LGTM, thank you!
Also a small drive-by fix to reduce unnecessary throwing of exceptions while running dotnet-pgo