-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Adding Int128 and UInt128 with a base software implementation #69204
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
Changes from 1 commit
897fdb9
2fe1618
6559609
2c820b5
e7970fb
828440f
6904e73
bcbc375
09e8bfc
5f9d22f
b6b85e6
9de4e76
a1dc14f
7666952
f0a30cb
cb5a82e
384e572
ab85c7b
163cfda
cd3c9e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9844,7 +9844,7 @@ void MethodTableBuilder::CheckForSystemTypes() | |
|
|
||
| if (strcmp(nameSpace, g_IntrinsicsNS) == 0) | ||
| { | ||
| EEClassLayoutInfo * pLayout = pClass->GetLayoutInfo(); | ||
| EEClassLayoutInfo* pLayout = pClass->GetLayoutInfo(); | ||
|
|
||
| // The SIMD Hardware Intrinsic types correspond to fundamental data types in the underlying ABIs: | ||
| // * Vector64<T>: __m64 | ||
|
|
@@ -9854,7 +9854,6 @@ void MethodTableBuilder::CheckForSystemTypes() | |
| // These __m128 and __m256 types, among other requirements, are special in that they must always | ||
| // be aligned properly. | ||
|
|
||
|
|
||
| if (strcmp(name, g_Vector64Name) == 0) | ||
| { | ||
| // The System V ABI for i386 defaults to 8-byte alignment for __m64, except for parameter passing, | ||
|
|
@@ -9898,6 +9897,21 @@ void MethodTableBuilder::CheckForSystemTypes() | |
|
|
||
| return; | ||
| } | ||
| #if defined(UNIX_AMD64_ABI) || defined(TARGET_ARM64) | ||
| else if (strcmp(nameSpace, g_SystemNS) == 0) | ||
| { | ||
| EEClassLayoutInfo* pLayout = pClass->GetLayoutInfo(); | ||
|
|
||
| // These types correspond to fundamental data types in the underlying ABIs: | ||
| // * Int128: __int128 | ||
| // * UInt128: unsigned __int128 | ||
|
|
||
| if ((strcmp(name, g_Int128Name) == 0) || (strcmp(name, g_UInt128Name) == 0)) | ||
| { | ||
| pLayout->m_ManagedLargestAlignmentRequirementOfAllMembers = 16; // sizeof(__int128) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs equivalent fix in crossgen/NativeAOT and in Mono
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @fanyang-mono could you point me to where I tried checking for where that's handled for the vector types, but couldn't find it.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. -- I fixed this up for crossgen/NativeAOT already and added corresponding P/Invoke tests to ensure the data is passed correctly to/from Native.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's handled in mono_class_layout_fields () in metadata/class-init.c.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't impact 32-bit platforms, only 64-bit platforms (and only 64-bit Unix at that).
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @vargaz, looks like its just blocked everywhere not just 32-bit platforms: https://github.com/dotnet/runtime/blob/main/src/mono/mono/metadata/class-init.c#L2058-L2065 It looks like Mono also isn't differentiating "alignment" from "packing" and so the layout of types that include the new This would explain why I couldn't find any logic touching
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it looks like this is not implemented right now in mono.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll log an issue to ensure this is tracked (I don't see an existing issue).
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Logged #69399 |
||
| } | ||
| } | ||
| #endif // UNIX_AMD64_ABI || TARGET_ARM64 | ||
| } | ||
|
|
||
| if (g_pNullableClass != NULL) | ||
|
|
||
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.
Is this used anywhere?
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.
This is what defines
g_Int128which is used inmethodTableBuilder.cpp(https://github.com/dotnet/runtime/pull/69204/files/cb5a82e5df48bf4a7c6deea85765c75d3d4a2e03#diff-4b65f34bf68fdb80cc734cc2435c72ef7f86ef16b9f56af47c06b87761383d3aR9909)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.
g_Int128Nameis defined in classnames.h. This macro definesCLASS_INT128that I do not see used anywhere.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.
Ah right, I was getting two two things mixed up.
Looks like this is missing handling in
classlayoutinfo.cppwhich copies the alignment requirement to thepNativeLayoutInfo: https://github.com/dotnet/runtime/blob/main/src/coreclr/vm/classlayoutinfo.cpp#L947-L964There 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.
Should be fixed. The only other usage of
CLASS__*for theVector*types was blocking interop which isn't required for Int128/UInt128 given the interop tests are all passing.