From: Michal Strehovský Date: Tue, 16 May 2023 17:37:09 +0000 (+0900) Subject: Fix handling of non-beforefieldinit interface cctors (#86311) X-Git-Tag: accepted/tizen/unified/riscv/20231226.055536~2193 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0692202f0e1aaaa0311a58129d5d4c9dd0880e16;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Fix handling of non-beforefieldinit interface cctors (#86311) Scanner would miss them. These trigger the same way as valuetype methods (instance methods will trigger them). --- diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/IL/ILImporter.Scanner.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/IL/ILImporter.Scanner.cs index 9e00383..6757a33 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/IL/ILImporter.Scanner.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/IL/ILImporter.Scanner.cs @@ -118,7 +118,7 @@ namespace Internal.IL // Don't trigger cctor if this is a fallback compilation (bad cctor could have been the reason for fallback). // Otherwise follow the rules from ECMA-335 I.8.9.5. if (!_isFallbackBodyCompilation && - (_canonMethod.Signature.IsStatic || _canonMethod.IsConstructor || owningType.IsValueType)) + (_canonMethod.Signature.IsStatic || _canonMethod.IsConstructor || owningType.IsValueType || owningType.IsInterface)) { // For beforefieldinit, we can wait for field access. if (!((MetadataType)owningType).IsBeforeFieldInit)