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

Fix issue where calculation of valuetypeshapecharacteristic on Arm64 does not match native runtime #73406

Merged
merged 1 commit into from
Aug 8, 2022

Conversation

davidwrighton
Copy link
Member

@davidwrighton davidwrighton commented Aug 4, 2022

  • We didn't check to make sure that the type of the Vector was a primitive numeric as the runtime does
  • Re-enable test

Fixes #60036

…does not match native runtime

- We didn't check to make sure that the type of the Vector<T> was a primitive numeric as the runtime does
- Re-enable test
Copy link
Member

@trylek trylek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for fixing this!

@AntonLapounov
Copy link
Member

AntonLapounov commented Aug 6, 2022

Vector<bool> is not supported and any operation on it will throw. Why do we even allow this type? @tannergooding

public static bool IsSupported
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => (typeof(T) == typeof(byte)) ||
(typeof(T) == typeof(double)) ||
(typeof(T) == typeof(short)) ||
(typeof(T) == typeof(int)) ||
(typeof(T) == typeof(long)) ||
(typeof(T) == typeof(nint)) ||
(typeof(T) == typeof(nuint)) ||
(typeof(T) == typeof(sbyte)) ||
(typeof(T) == typeof(float)) ||
(typeof(T) == typeof(ushort)) ||
(typeof(T) == typeof(uint)) ||
(typeof(T) == typeof(ulong));
}
.

@tannergooding
Copy link
Member

@AntonLapounov, even if the type can't do anything, a user may still end up declaring a Vector<bool> or a Vector<bool>* themselves and the runtime needs to be robust in the face of that.

We could theoretically throw a TypeLoadException if we ever encounted an unsupported T, but I don't see much practical benefit in that, especially since we have expanded the set of T over time and there may be a Vector<T> declared on an unused code path (under the relevant IsSupported check).

@AntonLapounov
Copy link
Member

Thank you for the explanation!

@davidwrighton davidwrighton merged commit a688d43 into dotnet:main Aug 8, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Sep 7, 2022
@davidwrighton davidwrighton deleted the fix_60036 branch April 13, 2023 18:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test failure: Assert failure: Verify_TypeLayout 'System.Numerics.Vector`1' failed to verify type layout
4 participants