Match HasLayoutMetadata to CoreCLR (dotnet/coreclr#27438)
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>
Fri, 25 Oct 2019 19:46:08 +0000 (21:46 +0200)
committerGitHub <noreply@github.com>
Fri, 25 Oct 2019 19:46:08 +0000 (21:46 +0200)
This caught my attention because I was messing with `IsBlittableType`.

The condition `type.BaseType.IsValueType` is never true because one can never have a type whose base type is a valuetype.

I was trying to find out where this code is coming from so I can fix it only to realize it was silently deleted in dotnet/coreclr#23015.

Commit migrated from https://github.com/dotnet/coreclr/commit/510dd30127777d85ea8831bdc474397a0b2070a8

src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs

index 51475e4..e91cc07 100644 (file)
@@ -1731,20 +1731,8 @@ namespace Internal.JitInterface
                 // Sequential layout
                 return true;
             }
-            else
-            {
-                // <BUGNUM>workaround for B#104780 - VC fails to set SequentialLayout on some classes
-                // with ClassSize. Too late to fix compiler for V1.
-                //
-                // To compensate, we treat AutoLayout classes as Sequential if they
-                // meet all of the following criteria:
-                //
-                //    - ClassSize present and nonzero.
-                //    - No instance fields declared
-                //    - Base class is System.ValueType.
-                //</BUGNUM>
-                return type.BaseType.IsValueType && !type.GetFields().GetEnumerator().MoveNext();
-            }
+
+            return false;
         }
 
         /// <summary>