-
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
JIT: Skip more covariance checks #107116
JIT: Skip more covariance checks #107116
Conversation
@EgorBot -arm64 -intel using BenchmarkDotNet.Attributes;
using System.Collections.Generic;
public class Bench
{
List<string> _list = new() { null };
[Benchmark]
public void Test() => _list[0] = "abc";
} |
Benchmark results on Intel
|
Benchmark results on Arm64
|
// Returns: | ||
// true if the store does not require a covariance check. | ||
// | ||
bool Compiler::gtCanSkipCovariantStoreCheck(GenTree* value, GenTree* array) |
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.
No changes here, it's just moved from importer.cpp and renamed.
Ugh, |
I think you could update |
I think it's still not enough sadly, say we have:
It is still going to return I was afraid of touching it, so I ended up just validating that the hint class actually has the field or not. |
This comment was marked as resolved.
This comment was marked as resolved.
@EgorBot -intel -arm64 using BenchmarkDotNet.Attributes;
using System.Collections.Generic;
public sealed class SealedClass {}
public class Bench
{
SealedClass _bench = new();
List<SealedClass> _list = new() { null };
[Benchmark]
public void Test() => _list[0] = _bench;
} |
Benchmark results on Intel
|
Benchmark results on Arm64
|
Right. A better name for this method would be
Thanks for checking. In case there are any cases that end up producing worse code, they must be very rare. The VM change LGTM. |
@jkotas does it look better now? It seems that R2R/NAOT don't use "fieldOwner" arg at all and manage to successfully generate expected code for my code example as is 😐 |
Are you able to construct a test case for the situation where we need to find a matching parent of the hint? Does this case work in AOT compilers too? |
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
I was not, it seems that the difference is that in case of CoreCLR, we first import
Not sure why that doesn't happen for CoreCLR:
|
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.
LGTM. Thanks!
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Closes #107080
Closes #96787
Was:
Now:
So we can either use a faster write barrier helper, or, like in this case, omit it at all.
Diffs - I was expecting more size regressions since we replace a call with a call + explicit bound checks, but, apparently, some opts kick in.