-
Notifications
You must be signed in to change notification settings - Fork 509
Base class library size on disk footprint workitems #5013
Comments
Are you trying to get rid of dependency on native metadata completely? I would think that saving the backing data for enums in the native metadata should be fine. Maybe the real problem here is that there is too much code required to fetch the enum values and names from native metadata.
These maybe candidates for readonly-value overrides implemented by Mono AOT: https://github.com/mono/mono/blob/50fa04c1365f68f309c6d0613c96672deb0d07fc/man/mono.1#L274 . The basic idea is that you place the call to the code you want to exclude behind a property and you tell the compiler what this property is going to return. It would be nice to do this optimization in IL Linker as an optional pass since it is generally applicable. Though this one is low-level and policy-free enough that we can live with it in the ILCompiler too. For globalization, we should base it on https://github.com/dotnet/corefx/blob/master/Documentation/architecture/globalization-invariant-mode.md. (It did not existed when the Dummy globalization was added.)
I would be nice to have an option to replace the localizable error strings with hardcoded single language messages; or no errors strings at all. Again, it would be nice to do this as optional pass in ILLinker.
It should be fetched from EEType when we have one. |
This. To do a
This is in a code path where all we have is a |
Contributes to dotnet#5013. This adds support for emitting new data structures that describe instance field layout of valuetypes that can't be memcompared. The data structure enables us to iterate over fields at runtime and compare them individually.
Contributes to dotnet#5013. Having reflection field access and custom attribute parsing support in a code path reachable from `Enum.ToString` means that any "hello world"-style app needs to have pretty much the full reflection stack embedded in it. The reflection stack is huge. I'm creating a shortcut EnumInfo that takes advantage of the fact that the TypeInfo is native metadata based and has a full type handle. It uses metadata APIs directly to read the metadata, bypassing the reflection stack.
Contributes to #5013. Having reflection field access and custom attribute parsing support in a code path reachable from `Enum.ToString` means that any "hello world"-style app needs to have pretty much the full reflection stack embedded in it. The reflection stack is huge. This also makes access to uncached `EnumInfo` marginally faster. This pretty much restores #3801, where we replaced the specialized code paths with the common reflection path to fix a bug around blocked types. I fix that bug by simply returning an empty `EnumInfo`. I had to make generic type definition EETypes carry their CorElementType to make this work property on generic type definitions of enums (for the corner case of enum type nested under a generic type). I'll see how difficult is it to add this to the binder on the Project N side when this ports over. If it's too complex, I'll simply restore the logic that accesses the first instance field type on generic definitions using reflection (under `#if PROJECTN`).
I spent some time looking into why an optimized Hello World is 3.8 MB big on Windows. There are two ways to look at this problem: what we do in the compiler to make it this big, and what we do in the class libraries that forces it to be so big. This issue tracks the latter.
With a set of hacks here Hello World can go down to about 2.4 MB. I was focusing mostly on getting the reflection stack out of the binary.
The problems:
MethodBase
when initializingStackFrame
, bringing a lot of MethodInfo support in. This is totally my fault. I asked for this to be implemented similar to CoreCLR, but we have good reasons to makeStackFrame
a bit different.ToString
. We'll need to generate this method. It better be lightweight.There are also some other opportunities I didn't measure yet:
The text was updated successfully, but these errors were encountered: