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

Enable reflection blocking#3685

Merged
MichalStrehovsky merged 2 commits intodotnet:masterfrom
MichalStrehovsky:blockReflection
May 25, 2017
Merged

Enable reflection blocking#3685
MichalStrehovsky merged 2 commits intodotnet:masterfrom
MichalStrehovsky:blockReflection

Conversation

@MichalStrehovsky
Copy link
Member

Reflection blocking is a size on disk optimization that prevents
generating native metadata for things that are considered
private implementation details of the runtime.

Since CoreRT is compiled ahead of time, a lot of things that
would be needed by a full VM (method names, custom attributes, etc.)
are no longer necessary at runtime. Metadata is strictly only necessary
to support reflection at runtime.

The policy I'm implementing is to consider everything private in our
implementation assemblies to be reflection blocked.

What this entails:

  • Adding support for computing reflection blocked state in the compiler
  • Tweak to blocking policy to allow us to express blocking state of MethodImpls
  • Uncomment blocking table mapping table scanning (this broke the PInvoke test for CppCodegen and we needed a workaround)
  • Opt in private assemblies to reflection blocking

...or: Substantially reduce our size on disk footprint

Reflection blocking is a size on disk optimization that prevents
generating native metadata for things that are considered
private implementation details of the runtime.

Since CoreRT is compiled ahead of time, a lot of things that
would be needed by a full VM (method names, custom attributes, etc.)
are no longer necessary at runtime. Metadata is strictly only necessary
to support reflection at runtime.

The policy I'm implementing is to consider everything private in our
implementation assemblies to be reflection blocked.

What this entails:

* Adding support for computing reflection blocked state in the compiler
* Tweak to blocking policy to allow us to express blocking state of MethodImpls
* Uncomment blocking table mapping table scanning (this broke the PInvoke test for CppCodegen and we needed a workaround)
* Opt in private assemblies to reflection blocking
@MichalStrehovsky
Copy link
Member Author

Some numbers (sizes in bytes, for x86ret):

Before After
BasicThreading 4,265,984 3,364,864
Generics 4,199,424 3,337,728
MultiModule 13,925,376 10,893,312

{
[AttributeUsage(AttributeTargets.All)]
internal class __BlockReflectionAttribute : Attribute { }
} No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed a newline?

@@ -0,0 +1,13 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a copyright header

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants