-
Notifications
You must be signed in to change notification settings - Fork 5.3k
CoreCLR support for InlineArrayAttribute. (struct layout part) #82744
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
da7b00b
170a306
bb1c3db
0a4cd78
6eeb887
f0d156b
470aee2
78ab523
a452be7
2801f50
e3284d1
4ff0a25
b406dfe
7f197d6
1852993
295caf1
e7738ea
065467b
62b20c8
01e2e17
f844772
1b5f608
bf676e4
7d42fbc
7fff2be
2d403ee
f6f6acc
d68cfa2
ebc698b
9373c77
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 |
|---|---|---|
|
|
@@ -1694,24 +1694,44 @@ MethodTableBuilder::BuildMethodTableThrowing( | |
| &pByValueClassCache, bmtMFDescs, bmtFP, | ||
| &totalDeclaredFieldSize); | ||
|
|
||
| // TODO: VS detect valArr | ||
| //if (!bmtGenericsInfo->fContainsGenericVariables && | ||
| // g_pValueArrayClass != NULL && | ||
| // g_pValueArrayClass->GetCl() == GetCl() && | ||
| // g_pValueArrayClass->GetModule() == bmtInternal->pType->GetModule()) | ||
| //{ | ||
| // TypeHandle lengthMarker = bmtGenericsInfo->GetInstantiation()[1]; | ||
| // if (lengthMarker.IsArray()) | ||
| // { | ||
| // DWORD rank = lengthMarker.GetRank(); | ||
| // if (rank > 1) | ||
| // { | ||
| // bmtFP->NumValueArrayElements = rank; | ||
| // // there is no scenario when tearing a value array into pieces is desirable. | ||
| // GetHalfBakedClass()->SetValueArrayFlag(); | ||
| // } | ||
| // } | ||
| //} | ||
| if (IsValueClass()) | ||
| { | ||
| const void* pVal; // The custom value. | ||
| ULONG cbVal; // Size of the custom value. | ||
| HRESULT hr = GetCustomAttribute(bmtInternal->pType->GetTypeDefToken(), | ||
| WellKnownAttribute::InlineArrayAttribute, | ||
| &pVal, &cbVal); | ||
|
|
||
| if (hr != S_FALSE) | ||
| { | ||
| if (bmtEnumFields->dwNumInstanceFields != 1) | ||
| { | ||
| // TODO: diagnostics, must have one field. | ||
| BuildMethodTableThrowException(IDS_CLASSLOAD_GENERAL); | ||
|
||
| } | ||
|
|
||
| if (cbVal >= (sizeof(INT32) + 2)) | ||
|
||
| { | ||
| INT32 repeat = GET_UNALIGNED_VAL32((byte*)pVal + 2); | ||
| if (repeat > 0) | ||
| { | ||
| bmtFP->NumValueArrayElements = repeat; | ||
| GetHalfBakedClass()->SetValueArrayFlag(); | ||
| } | ||
| else | ||
| { | ||
| // TODO: diagnostics, repeat must be > 0 | ||
| BuildMethodTableThrowException(IDS_CLASSLOAD_GENERAL); | ||
| } | ||
|
|
||
| if (HasExplicitFieldOffsetLayout()) | ||
| { | ||
| // TODO: diagnostics, must not have explicit offsets | ||
VSadov marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| BuildMethodTableThrowException(IDS_CLASSLOAD_GENERAL); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Place regular static fields | ||
| PlaceRegularStaticFields(); | ||
|
|
@@ -8342,8 +8362,9 @@ VOID MethodTableBuilder::PlaceInstanceFields(MethodTable ** pByValueClassCach | |
| BuildMethodTableThrowException(IDS_CLASSLOAD_FIELDTOOLARGE); | ||
| } | ||
|
|
||
| if (bmtFP->NumValueArrayElements > 0) | ||
| if (bmtFP->NumValueArrayElements > 1) | ||
| { | ||
| // TODO: VS validate that size < FIELD_OFFSET_LAST_REAL_OFFSET | ||
| dwNumInstanceFieldBytes *= bmtFP->NumValueArrayElements; | ||
|
|
||
| if (pFieldDescList[0].IsByValue()) | ||
|
|
@@ -11529,7 +11550,7 @@ VOID MethodTableBuilder::HandleGCForValueClasses(MethodTable ** pByValueClassCac | |
| } | ||
|
|
||
| DWORD repeat = 1; | ||
| if (bmtFP->NumValueArrayElements > 0) | ||
| if (bmtFP->NumValueArrayElements > 1) | ||
| { | ||
| _ASSERTE(bmtEnumFields->dwNumInstanceFields == 1); | ||
| repeat = bmtFP->NumValueArrayElements; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.