diff options
Diffstat (limited to 'src/Common/src/TypeSystem/Common/DefType.FieldLayout.cs')
-rw-r--r-- | src/Common/src/TypeSystem/Common/DefType.FieldLayout.cs | 49 |
1 files changed, 42 insertions, 7 deletions
diff --git a/src/Common/src/TypeSystem/Common/DefType.FieldLayout.cs b/src/Common/src/TypeSystem/Common/DefType.FieldLayout.cs index 497701812..7f5638607 100644 --- a/src/Common/src/TypeSystem/Common/DefType.FieldLayout.cs +++ b/src/Common/src/TypeSystem/Common/DefType.FieldLayout.cs @@ -55,7 +55,8 @@ namespace Internal.TypeSystem { public StaticsBlock NonGcStatics; public StaticsBlock GcStatics; - public StaticsBlock ThreadStatics; + public StaticsBlock ThreadNonGcStatics; + public StaticsBlock ThreadGcStatics; } ThreadSafeFlags _fieldLayoutFlags; @@ -217,10 +218,42 @@ namespace Internal.TypeSystem } /// <summary> + /// How many bytes must be allocated to represent the non GC visible thread static fields + /// of this type. + /// </summary> + public LayoutInt ThreadNonGcStaticFieldSize + { + get + { + if (!_fieldLayoutFlags.HasFlags(FieldLayoutFlags.ComputedStaticRegionLayout)) + { + ComputeStaticFieldLayout(StaticLayoutKind.StaticRegionSizes); + } + return _staticBlockInfo == null ? LayoutInt.Zero : _staticBlockInfo.ThreadNonGcStatics.Size; + } + } + + /// <summary> + /// What is the alignment required for allocating the non GC visible thread static fields + /// of this type. + /// </summary> + public LayoutInt ThreadNonGcStaticFieldAlignment + { + get + { + if (!_fieldLayoutFlags.HasFlags(FieldLayoutFlags.ComputedStaticRegionLayout)) + { + ComputeStaticFieldLayout(StaticLayoutKind.StaticRegionSizes); + } + return _staticBlockInfo == null ? LayoutInt.Zero : _staticBlockInfo.ThreadNonGcStatics.LargestAlignment; + } + } + + /// <summary> /// How many bytes must be allocated to represent the (potentially GC visible) thread static /// fields of this type. /// </summary> - public LayoutInt ThreadStaticFieldSize + public LayoutInt ThreadGcStaticFieldSize { get { @@ -228,7 +261,7 @@ namespace Internal.TypeSystem { ComputeStaticFieldLayout(StaticLayoutKind.StaticRegionSizes); } - return _staticBlockInfo == null ? LayoutInt.Zero : _staticBlockInfo.ThreadStatics.Size; + return _staticBlockInfo == null ? LayoutInt.Zero : _staticBlockInfo.ThreadGcStatics.Size; } } @@ -236,7 +269,7 @@ namespace Internal.TypeSystem /// What is the alignment required for allocating the (potentially GC visible) thread static /// fields of this type. /// </summary> - public LayoutInt ThreadStaticFieldAlignment + public LayoutInt ThreadGcStaticFieldAlignment { get { @@ -244,7 +277,7 @@ namespace Internal.TypeSystem { ComputeStaticFieldLayout(StaticLayoutKind.StaticRegionSizes); } - return _staticBlockInfo == null ? LayoutInt.Zero : _staticBlockInfo.ThreadStatics.LargestAlignment; + return _staticBlockInfo == null ? LayoutInt.Zero : _staticBlockInfo.ThreadGcStatics.LargestAlignment; } } @@ -328,13 +361,15 @@ namespace Internal.TypeSystem if ((computedStaticLayout.NonGcStatics.Size != LayoutInt.Zero) || (computedStaticLayout.GcStatics.Size != LayoutInt.Zero) || - (computedStaticLayout.ThreadStatics.Size != LayoutInt.Zero)) + (computedStaticLayout.ThreadNonGcStatics.Size != LayoutInt.Zero) || + (computedStaticLayout.ThreadGcStatics.Size != LayoutInt.Zero)) { var staticBlockInfo = new StaticBlockInfo { NonGcStatics = computedStaticLayout.NonGcStatics, GcStatics = computedStaticLayout.GcStatics, - ThreadStatics = computedStaticLayout.ThreadStatics + ThreadNonGcStatics = computedStaticLayout.ThreadNonGcStatics, + ThreadGcStatics = computedStaticLayout.ThreadGcStatics }; _staticBlockInfo = staticBlockInfo; } |