Enable thread static fields for r2r
Split the thread static field access in the Jit interface to sort fields into the four tables expected by CoreCLR.
This commit is contained in:
Родитель
8ca402c5a3
Коммит
569befaaff
|
@ -22,6 +22,7 @@ namespace ILCompiler.DependencyAnalysis
|
|||
GetNonGCStaticBase,
|
||||
GetGCStaticBase,
|
||||
GetThreadStaticBase,
|
||||
GetThreadNonGcStaticBase,
|
||||
DelegateCtor,
|
||||
ResolveVirtualFunction,
|
||||
|
||||
|
|
|
@ -187,7 +187,11 @@ namespace ILCompiler.DependencyAnalysis
|
|||
break;
|
||||
|
||||
case ReadyToRunHelperId.GetThreadStaticBase:
|
||||
helperNode = CreateThreadStaticBaseHelper((TypeDesc)target, token);
|
||||
helperNode = CreateThreadGcStaticBaseHelper((TypeDesc)target, token);
|
||||
break;
|
||||
|
||||
case ReadyToRunHelperId.GetThreadNonGcStaticBase:
|
||||
helperNode = CreateThreadNonGcStaticBaseHelper((TypeDesc)target, token);
|
||||
break;
|
||||
|
||||
case ReadyToRunHelperId.IsInstanceOf:
|
||||
|
@ -284,14 +288,22 @@ namespace ILCompiler.DependencyAnalysis
|
|||
new TypeFixupSignature(Resolver, ReadyToRunFixupKind.READYTORUN_FIXUP_StaticBaseNonGC, type, GetTypeToken(token)));
|
||||
}
|
||||
|
||||
private ISymbolNode CreateThreadStaticBaseHelper(TypeDesc type, ModuleToken token)
|
||||
private ISymbolNode CreateThreadGcStaticBaseHelper(TypeDesc type, ModuleToken token)
|
||||
{
|
||||
ReadyToRunFixupKind fixupKind = ReadyToRunFixupKind.READYTORUN_FIXUP_ThreadStaticBaseNonGC;
|
||||
return new DelayLoadHelperImport(
|
||||
this,
|
||||
HelperImports,
|
||||
ILCompiler.DependencyAnalysis.ReadyToRun.ReadyToRunHelper.READYTORUN_HELPER_DelayLoad_Helper,
|
||||
new TypeFixupSignature(Resolver, fixupKind, type, GetTypeToken(token)));
|
||||
new TypeFixupSignature(Resolver, ReadyToRunFixupKind.READYTORUN_FIXUP_ThreadStaticBaseGC, type, GetTypeToken(token)));
|
||||
}
|
||||
|
||||
private ISymbolNode CreateThreadNonGcStaticBaseHelper(TypeDesc type, ModuleToken token)
|
||||
{
|
||||
return new DelayLoadHelperImport(
|
||||
this,
|
||||
HelperImports,
|
||||
ILCompiler.DependencyAnalysis.ReadyToRun.ReadyToRunHelper.READYTORUN_HELPER_DelayLoad_Helper,
|
||||
new TypeFixupSignature(Resolver, ReadyToRunFixupKind.READYTORUN_FIXUP_ThreadStaticBaseNonGC, type, GetTypeToken(token)));
|
||||
}
|
||||
|
||||
private ModuleToken GetTypeToken(ModuleToken token)
|
||||
|
|
|
@ -32,7 +32,8 @@ namespace ILCompiler
|
|||
{
|
||||
layout.NonGcStatics.Size = _initialNonGcStaticsOffset;
|
||||
layout.GcStatics.Size = LayoutInt.Zero;
|
||||
layout.ThreadStatics.Size = LayoutInt.Zero;
|
||||
layout.ThreadNonGcStatics.Size = LayoutInt.Zero;
|
||||
layout.ThreadGcStatics.Size = LayoutInt.Zero;
|
||||
}
|
||||
|
||||
protected override void FinalizeRuntimeSpecificStaticFieldLayout(TypeSystemContext context, ref ComputedStaticFieldLayout layout)
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace ILCompiler
|
|||
private readonly HashSet<TypeDesc> _typesWithAvailableTypesGenerated = new HashSet<TypeDesc>();
|
||||
|
||||
public ReadyToRunTableManager(CompilerTypeSystemContext typeSystemContext)
|
||||
: base(typeSystemContext, new NoMetadataBlockingPolicy(), new NoManifestResourceBlockingPolicy()) {}
|
||||
: base(typeSystemContext, new NoMetadataBlockingPolicy(), new NoManifestResourceBlockingPolicy(), new NoDynamicInvokeThunkGenerationPolicy()) {}
|
||||
|
||||
public override void AddToReadyToRunHeader(ReadyToRunHeaderNode header, NodeFactory nodeFactory, ExternalReferencesTableNode commonFixupsTableNode)
|
||||
{
|
||||
|
@ -46,7 +46,6 @@ namespace ILCompiler
|
|||
|
||||
public override MethodDesc GetCanonicalReflectionInvokeStub(MethodDesc method) => throw new NotImplementedException();
|
||||
public override IEnumerable<ModuleDesc> GetCompilationModulesWithMetadata() => throw new NotImplementedException();
|
||||
public override bool HasReflectionInvokeStubForInvokableMethod(MethodDesc method) => throw new NotImplementedException();
|
||||
public override bool WillUseMetadataTokenToReferenceField(FieldDesc field) => throw new NotImplementedException();
|
||||
public override bool WillUseMetadataTokenToReferenceMethod(MethodDesc method) => throw new NotImplementedException();
|
||||
protected override void ComputeMetadata(NodeFactory factory, out byte[] metadataBlob, out List<MetadataMapping<MetadataType>> typeMappings, out List<MetadataMapping<MethodDesc>> methodMappings, out List<MetadataMapping<FieldDesc>> fieldMappings, out List<MetadataMapping<MethodDesc>> stackTraceMapping) => throw new NotImplementedException();
|
||||
|
|
|
@ -1973,7 +1973,18 @@ namespace Internal.JitInterface
|
|||
// Find out what kind of base do we need to look up.
|
||||
if (field.IsThreadStatic)
|
||||
{
|
||||
#if READYTORUN
|
||||
if (field.HasGCStaticBase)
|
||||
{
|
||||
helperId = ReadyToRunHelperId.GetThreadStaticBase;
|
||||
}
|
||||
else
|
||||
{
|
||||
helperId = ReadyToRunHelperId.GetThreadNonGcStaticBase;
|
||||
}
|
||||
#else
|
||||
helperId = ReadyToRunHelperId.GetThreadStaticBase;
|
||||
#endif
|
||||
}
|
||||
else if (field.HasGCStaticBase)
|
||||
{
|
||||
|
@ -2010,7 +2021,18 @@ namespace Internal.JitInterface
|
|||
ReadyToRunHelperId helperId = ReadyToRunHelperId.Invalid;
|
||||
if (field.IsThreadStatic)
|
||||
{
|
||||
#if READYTORUN
|
||||
if (field.HasGCStaticBase)
|
||||
{
|
||||
helperId = ReadyToRunHelperId.GetThreadStaticBase;
|
||||
}
|
||||
else
|
||||
{
|
||||
helperId = ReadyToRunHelperId.GetThreadNonGcStaticBase;
|
||||
}
|
||||
#else
|
||||
helperId = ReadyToRunHelperId.GetThreadStaticBase;
|
||||
#endif
|
||||
}
|
||||
else if (field.HasGCStaticBase)
|
||||
{
|
||||
|
|
|
@ -9,10 +9,10 @@ using System.Text;
|
|||
|
||||
internal class Program
|
||||
{
|
||||
// [ThreadStatic]
|
||||
[ThreadStatic]
|
||||
private static string TextFileName = @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\clientexclusionlist.xml";
|
||||
|
||||
//[ThreadStatic]
|
||||
[ThreadStatic]
|
||||
private static int LineCount = 0x12345678;
|
||||
|
||||
private static List<string> _passedTests;
|
||||
|
|
Загрузка…
Ссылка в новой задаче