-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Get rid of reflection blocked types #85810
Get rid of reflection blocked types #85810
Conversation
Fixes dotnet#72570. Still need to delete workarounds that make things public in corelib but maybe this diff is large enough already? We were gradually getting less and less from reflection blocking: * We stopped blocking things outside corelib (.NET Native blocked all of BCL; we don't). * We trim reflection metadata and that allows us to have method bodies without metadata. With this, we should be able to get type definition-level reflection metadata for any MethodTable there is in the system. This is a ~30 kB size regression for BasicMinimalApis. It is pretty much a wash for Hello World, because all the BCL cruft to handle reflection blocked types costs as much as the benefit of blocking.
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue DetailsFixes #72570. Still need to delete workarounds that make things public in corelib but maybe this diff is large enough already? We were gradually getting less and less from reflection blocking:
With this, we should be able to get type definition-level reflection metadata for any MethodTable there is in the system. This is a ~30 kB size regression for BasicMinimalApis. It is pretty much a wash for Hello World, because all the BCL cruft to handle reflection blocked types costs as much as the benefit of blocking. Cc @dotnet/ilc-contrib
|
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.
Thank you!
Unfortunately, the test failures are real. There is one other kind of For example I'm fixing it by giving necessary MethodTables reflection metadata. It means they're now user visible and users can browse to them with e.g. |
This is an extra couple kB regression. It's not too bad. |
Okay, so on Linux the regression on Hello world is much worse - ~1,569 kB to 1,821 kB. Need to figure that out first 😭. |
The Linux regression was the same problem as #84156 (comment) with the SpanAction thing. @jkotas could you have a look at that commit? I made a small functional change in it because it looks like we were passing a wrong size of the buffer so I fixed that. |
src/libraries/System.Private.CoreLib/src/System/Text/Latin1Encoding.cs
Outdated
Show resolved
Hide resolved
…oding.cs Co-authored-by: Jan Kotas <[email protected]>
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
src/libraries/System.Private.CoreLib/src/System/Text/Latin1Encoding.cs
Outdated
Show resolved
Hide resolved
…oding.cs Co-authored-by: Jan Kotas <[email protected]>
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
Concept of reflection blocked internals was deleted in dotnet#85810. This is no longer needed.
* Stop special casing reflected-on internals Concept of reflection blocked internals was deleted in #85810. This is no longer needed. * Can no longer access ResourceSet outside corelib
Nice! Thanks for all the hard work here @MichalStrehovsky and @jkotas, much appreciated |
After dotnet#85810 we need to generate reflection metadata for owning types of static synchronized methods. Before that change, obtaining a RuntimeType for locking would obtain a reflection blocked type. We now need a named type and scanner must predict it. Found in Pri0 testing.
After #85810 we need to generate reflection metadata for owning types of static synchronized methods. Before that change, obtaining a RuntimeType for locking would obtain a reflection blocked type. We now need a named type and scanner must predict it. Found in Pri0 testing.
Fixes #72570.
Still need to delete workarounds that make things public in corelib but maybe this diff is large enough already?
We were gradually getting less and less from reflection blocking:
With this, we should be able to get type definition-level reflection metadata for any MethodTable there is in the system.
This is a ~30 kB size regression for BasicMinimalApis. It is pretty much a wash for Hello World, because all the BCL cruft to handle reflection blocked types costs as much as the benefit of blocking.
Cc @dotnet/ilc-contrib