Update the previous crossgen2 fix to interface static cctor (#396)
authorJan Vorlicek <janvorli@microsoft.com>
Fri, 29 Nov 2019 19:38:20 +0000 (20:38 +0100)
committerJan Kotas <jkotas@microsoft.com>
Fri, 29 Nov 2019 19:38:20 +0000 (11:38 -0800)
This change makes the interface static cctor fix equivalent to the
runtime's one.

src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs

index 93f6d7a..fb1f990 100644 (file)
@@ -1642,7 +1642,7 @@ namespace Internal.JitInterface
                 // This optimization may cause static fields in reference types to be accessed without cctor being triggered
                 // for NULL "this" object. It does not conform with what the spec says. However, we have been historically 
                 // doing it for perf reasons.
-                if (!typeToInit.IsValueType && !typeToInit.IsBeforeFieldInit)
+                if (!typeToInit.IsValueType && ! typeToInit.IsInterface && !typeToInit.IsBeforeFieldInit)
                 {
                     if (typeToInit == typeFromContext(context) || typeToInit == MethodBeingCompiled.OwningType)
                     {