Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common/src/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs')
-rw-r--r--src/Common/src/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/Common/src/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs b/src/Common/src/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs
index ab35f0548..94074e1d8 100644
--- a/src/Common/src/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs
+++ b/src/Common/src/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs
@@ -185,7 +185,8 @@ namespace Internal.TypeSystem
ComputedStaticFieldLayout result;
result.GcStatics = new StaticsBlock();
result.NonGcStatics = new StaticsBlock();
- result.ThreadStatics = new StaticsBlock();
+ result.ThreadGcStatics = new StaticsBlock();
+ result.ThreadNonGcStatics = new StaticsBlock();
if (numStaticFields == 0)
{
@@ -231,7 +232,12 @@ namespace Internal.TypeSystem
private ref StaticsBlock GetStaticsBlockForField(ref ComputedStaticFieldLayout layout, FieldDesc field)
{
if (field.IsThreadStatic)
- return ref layout.ThreadStatics;
+ {
+ if (field.HasGCStaticBase)
+ return ref layout.ThreadGcStatics;
+ else
+ return ref layout.ThreadNonGcStatics;
+ }
else if (field.HasGCStaticBase)
return ref layout.GcStatics;
else
@@ -293,7 +299,7 @@ namespace Internal.TypeSystem
var layoutMetadata = type.GetClassLayout();
- int packingSize = ComputePackingSize(type);
+ int packingSize = ComputePackingSize(type, layoutMetadata);
LayoutInt largestAlignmentRequired = LayoutInt.One;
var offsets = new FieldAndOffset[numInstanceFields];
@@ -353,9 +359,11 @@ namespace Internal.TypeSystem
// For types inheriting from another type, field offsets continue on from where they left off
LayoutInt cumulativeInstanceFieldPos = ComputeBytesUsedInParentType(type);
+ var layoutMetadata = type.GetClassLayout();
+
LayoutInt largestAlignmentRequirement = LayoutInt.One;
int fieldOrdinal = 0;
- int packingSize = ComputePackingSize(type);
+ int packingSize = ComputePackingSize(type, layoutMetadata);
foreach (var field in type.GetFields())
{
@@ -375,7 +383,6 @@ namespace Internal.TypeSystem
if (type.IsValueType)
{
- var layoutMetadata = type.GetClassLayout();
cumulativeInstanceFieldPos = LayoutInt.Max(cumulativeInstanceFieldPos, new LayoutInt(layoutMetadata.Size));
}
@@ -442,10 +449,8 @@ namespace Internal.TypeSystem
return result;
}
- private static int ComputePackingSize(MetadataType type)
+ private static int ComputePackingSize(MetadataType type, ClassLayoutMetadata layoutMetadata)
{
- var layoutMetadata = type.GetClassLayout();
-
// If a type contains pointers then the metadata specified packing size is ignored (On desktop this is disqualification from ManagedSequential)
if (layoutMetadata.PackingSize == 0 || type.ContainsGCPointers)
return type.Context.Target.DefaultPackingSize;