runtime
runtime copied to clipboard
Make it possible to eliminate branches guarded by IsEnum
We use this check in CoreLib and currently it includes some unreachable code with a big closure.
Does handling the internal IsActualEnum
here too make sense?
Does handling the internal
IsActualEnum
here too make sense?
This only helps things like typeof(T).IsEnum
. It doesn't do anything for when we have a System.Type from who-knows-where. If we use IsActualEnum on typeof(T)
anywhere, we should just switch it to IsEnum.
Wondering if this could also give us some size savings in CsWinRT. Eg. we have a few branches on this there (example):
Wondering if this could also give us some size savings in CsWinRT. Eg. we have a few branches on this there (example):
Yes, that would probably help here.
I'll merge this then. I wasn't fully convinced we really want this without the rest. Despite the impression I'm giving here, I don't particularly like we do this IL rewriting.
Size statistics
Pull request dotnet/runtime#100399
Project | Size before | Size after | Difference |
---|---|---|---|
avalonia.app-linux | 24496560 | 24492464 | -4096 |
avalonia.app-windows | 22036480 | 22031360 | -5120 |
hello-linux | 1377040 | 1348240 | -28800 |
hello-minimal-linux | 1110696 | 1085992 | -24704 |
hello-minimal-windows | 885248 | 864256 | -20992 |
hello-windows | 1133056 | 1109504 | -23552 |
kestrel-minimal-linux | 5772000 | 5767904 | -4096 |
kestrel-minimal-windows | 5072384 | 5070848 | -1536 |
reflection-linux | 2294656 | 2294656 | 0 |
reflection-windows | 1944576 | 1944064 | -512 |
webapiaot-linux | 10249144 | 10228632 | -20512 |
webapiaot-windows | 9206272 | 9188352 | -17920 |