Uh oh!
There was an error while loading. Please reload this page.
Optimize typeof(T).IsValueType - #1157
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I find the following tests quite weird (matching current behaviour): IsTrue(typeof(int*).IsClass)
IsTrue (typeof(Action<int>).IsClass);IsFalse(typeof(ValueType).IsValueType);IsTrue(typeof(ValueType).IsClass);<removed> |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
jkotas
commented
Dec 26, 2019
I believe that's because of the tests have a few copy&paste bugs. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
e3da25f to
a6f6f13Compare
jkotas
left a comment
There was a problem hiding this comment.
LGTM. Thank you!
I would like somebody from the JIT team to sign-off on this as well before merging.
Uh oh!
There was an error while loading. Please reload this page.
Can now be JITted to a constant on .NET 5, see dotnet/runtime#1157
Fixes https://github.com/dotnet/coreclr/issues/23208
Also, contributes to https://github.com/dotnet/coreclr/issues/2591
Also, dotnet/aspnetcore@a42fff6
Replaces patterns like
typeof(T).IsValueTypeorvar.GetType().IsValueType()with constants (true/false).E.g.:
Current codegen:
New codegen:
This PR also implements
Type.IsPrimitiveandType.IsClass. Probably can implement more for free, e.g.Type.IsArrayandType.IsEnum(this one is virtual)