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:
authorPeter Sollich <petersol@microsoft.com>2016-07-12 11:36:39 +0300
committerPeter Sollich <petersol@microsoft.com>2016-07-12 11:36:39 +0300
commit8096334ec4f09f6686fc5bc8c7080caeba0cfc31 (patch)
tree117ed553a1833c867d294a1794439312e0d04809 /src/ILCompiler.MetadataTransform
parent83ca7616c51742001ba670cfc9dd95881b99de80 (diff)
Port changeset #1617250 in branche ProjNDev2 to main branch at Michal's request - here's the checkin comment for that changeset:
Fix TODO in InitializeFieldDefinition - this caused incorrect field offsets in explicit layout types. While investigating JIT test failures (jit\SIMD\BoxUnbox.csproj and jit\SIMD\VectorMatrix.csproj) I found that the dynamic type loader computes an incorrect size for structs with explicit layout. As it turns out, the native metadata is already wrong and doesn't contain the field offset specified in the source via the FieldOffset attribute (and present in EMCA metadata). The fix is simply to get the offset from the ECMA metadata reader. That API however returns -1 for the case where no explicit offset was specified, so that needs to be checked for. [tfs-changeset: 1617255]
Diffstat (limited to 'src/ILCompiler.MetadataTransform')
-rw-r--r--src/ILCompiler.MetadataTransform/src/ILCompiler/Metadata/Transform.Field.cs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ILCompiler.MetadataTransform/src/ILCompiler/Metadata/Transform.Field.cs b/src/ILCompiler.MetadataTransform/src/ILCompiler/Metadata/Transform.Field.cs
index e82034211..55238f6c0 100644
--- a/src/ILCompiler.MetadataTransform/src/ILCompiler/Metadata/Transform.Field.cs
+++ b/src/ILCompiler.MetadataTransform/src/ILCompiler/Metadata/Transform.Field.cs
@@ -71,9 +71,11 @@ namespace ILCompiler.Metadata
{
record.CustomAttributes = HandleCustomAttributes(ecmaField.Module, customAttributes);
}
- }
- // TODO: Offset
+ int offset = fieldDef.GetOffset();
+ if (offset >= 0)
+ record.Offset = (uint)offset;
+ }
}
private MemberReference HandleFieldReference(Cts.FieldDesc field)