You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
GetThreadStaticsBase method is not included in R2R image #123616
Thread static helpers were moved to managed code in https://github.com/dotnet/runtime/pull/108167/files. It seems GetThreadStaticsBase has a BypassReadyToRunAttribute as a workaround for some recursive dependency during initialization. On iOS this is relevant because every single thread static field access will now go through interpreter, which is much slower.
On the following microbenchmark, running in composite-r2r configuration with interpreter fallback (jit disabled) is 35x slower than default jit configuration.
using System;
using System.Runtime.CompilerServices;
using System.Threading;
public class Program {
[ThreadStatic]
private static int a;
[MethodImpl(MethodImplOptions.NoInlining)]
public static int GetA()
{
return a;
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static void SetA(int val)
{
a = val;
}
public static void Main(string[] args)
{
a = 1;
for (int i = 0; i < 500000000; i++)
SetA(GetA() + 1);
}
}
Activity
BrzVlad commentedon Jan 26, 2026
@davidwrighton Could you please give this a thought ?
Fix GetThreadStaticsBase to be included in R2R images (#123812)
Fix GetThreadStaticsBase to be included in R2R images (dotnet#123812)