Skip to content
This repository was archived by the owner on Nov 1, 2020. It is now read-only.

Conversation

@MichalStrehovsky
Copy link
Member

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 `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).
@MichalStrehovsky
Copy link
Member Author

@atsushikan could you please take a look?

@ghost
Copy link

ghost commented Feb 23, 2018

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 IsByRefLike needs to probe custom attributes is in itself something that sticks in my craw as it makes it the only type classifier predicate that reaches code that's both expensive and prone to throwing MissingMetadataExceptions, though I believe the existing reducer behavior would never let that happen.)

@jkotas
Copy link
Member

jkotas commented Feb 23, 2018

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.

@ghost
Copy link

ghost commented Feb 23, 2018

That would work too. I generally prefer not to put restrictions on constructed Type creation when it's really a runtime restriction on instantiation.

@ghost
Copy link

ghost commented Feb 26, 2018

You should probably leave the IsByRef part where it was. It may cause some compat test failures if we're throwing exceptions in a different order from CoreCLR.

@ghost
Copy link

ghost commented Feb 26, 2018

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.)

@jkotas jkotas merged commit 10dfb18 into dotnet:master Feb 26, 2018
@MichalStrehovsky MichalStrehovsky deleted the moveByRefLikeCheck branch February 26, 2018 17:53
kbaladurin pushed a commit to kbaladurin/corert that referenced this pull request Mar 15, 2018
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).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants