-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Share some array code between CoreCLR and NativeAOT #116903
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
base: main
Are you sure you want to change the base?
Conversation
{ | ||
if (array == null) | ||
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array); | ||
int rank = this.GetMethodTable()->MultiDimensionalArrayRank; |
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.
You have update this to match CoreCLR impl. Should it be moved to shared part as well?
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.
It is ok to pay the extra addition for non-zero lower bounds, even though they are not supported in native aot currently.
If we want to avoid it, we can introduce a static bool IsNonZeroLowerBoundSupported
property on Array that return returns true on CoreCLR and false on NAOT, and use it to avoid the unnecessary addition.
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.
Sure, then GetLowerBound/GetUpperBound/GetLength can be unified too.
Good job. At least the |
Yes I've mentioned it, I'm having trouble for running nativeaot tests locally, or mapping the throwing offset to code. |
Not sure if it helps but in debug build it asserts here:
|
OK, I was thinking no exception was thrown and the pointer types passed assignment test, and figuring out which line passes. Thanks for pointing out the failing stack trace. |
I see. I was trying to use filter and |
Shares the major logic of Copy and Clear, cleared some others.
Using coreclr behavior has source of truth. NativeAOT didn't support primitive widen for enum->enum.