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
Fix rounding error in getLikelyClassesOrMethods #86965
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsIt seems that sometimes public static void Main(string[] args)
{
for (int i = 0; i < 200; i++)
{
Test(new MyClass1());
Test(new MyClass1());
Test(new MyClass1());
Test(new MyClass2());
Test(new MyClass3());
Thread.Sleep(16);
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
static int Test(IValue value) => value.GetValue(); - 1) 00007FFF3995A8C0 (MyClass1) [likelihood:50%]
+ 1) 00007FFF3995A8C0 (MyClass1) [likelihood:51%]
2) 00007FFF3995AA88 (MyClass2) [likelihood:37%]
3) 00007FFF3995AC50 (MyClass3) [likelihood:12%]
|
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
It seems that sometimes
getLikelyClasses
reports that fallback has e.g. 1% likelihood where in fact it's 0. It happens because of the rounding error accumulated ingetLikelyClassesOrMethods
. It prevents JIT from moving that fallback to a cold section.