-
Notifications
You must be signed in to change notification settings - Fork 506
Move check for IsByRefLike to MakeArrayType #5439
Conversation
Having a call to `IsByRefLike` in the type unifier meant that an app that uses a simple `typeof()` would require the full reflection stack to be present in the image (all of the custom attribute resolution, method resolution, etc.). This is a step towards having a more pay for play framework (a hello world EXE really should not have the full reflection stack compiled in it).
|
@atsushikan could you please take a look? |
|
This does mean, though, that every call to MakeArrayType incurs the cost of that check even if the array type had been previously constructed and memoized. The custom attribute check only occurs in that corner case of a metadata-carrying type without an EEType. Is there no other way to make that section of the code pay-for-play? Or encode the "this is a byreflike type" in a more direct way within the native metadata format? (Edit: The fact is |
|
Would it be better to do these checks only once you actually try to allocate one of these? The way these checks are done is pretty ad-hoc. E.g. the check for array of void is done during allocation. I do not think it would do much harm to do the byreflike check there as well. |
|
That would work too. I generally prefer not to put restrictions on constructed Type creation when it's really a runtime restriction on instantiation. |
|
You should probably leave the |
|
I'll assume this still matches CoreCLR's observable validation order (or that you'll make the necessary changes to CoreCLR to match it up.) |
Having a call to `IsByRefLike` in the type unifier meant that an app that uses a simple `typeof()` would require the full reflection stack to be present in the image (all of the custom attribute resolution, method resolution, etc.). This is a step towards having a more pay for play framework (a hello world EXE really should not have the full reflection stack compiled in it).
Having a call to
IsByRefLikein the type unifier meant that an app that uses a simpletypeof()would require the full reflection stack to be present in the image (all of the custom attribute resolution, method resolution, etc.).This is a step towards having a more pay for play framework (a hello world EXE really should not have the full reflection stack compiled in it).