Skip to content

Crossgen2 error on arm64 for GitHub_17777 #59040

@gbalykov

Description

@gbalykov

Reproduces on: 9f6da55, release 6.0-preview7

Crossgen2 throws exception during compilation of GitHub_17777.dll test on arm64 (rpi4) with System.Runtime.dll in references.

bash-3.2# /opt/usr/coreclr-tc/coreroot/corerun /opt/usr/coreclr-tc/coreroot/crossgen2/crossgen2.dll --jitpath /opt/usr/coreclr-tc/coreroot/libclrjit.so --targetarch arm64 --parallelism 4 -O  -o:/opt/usr/coreclr-tc/JIT/Regression/JitBlue/GitHub_17777/GitHub_17777/GitHub_17777.ni.dll /opt/usr/coreclr-tc/JIT/Regression/JitBlue/GitHub_17777/GitHub_17777/GitHub_17777.dll  -r:/opt/usr/coreclr-tc/coreroot/System.Private.CoreLib.dll -r:/opt/usr/coreclr-tc/coreroot/System.Runtime.dll -r:/opt/usr/coreclr-tc/JIT/Regression/JitBlue/GitHub_17777/GitHub_17777/GitHub_17777.dll
Emitting R2R PE file: /opt/usr/coreclr-tc/JIT/Regression/JitBlue/GitHub_17777/GitHub_17777/GitHub_17777.ni.dll
Error: Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
   at ILCompiler.DependencyAnalysis.ReadyToRun.MethodGCInfoNode.EncodeDataCore(NodeFactory factory)+MoveNext()
   at ILCompiler.DependencyAnalysis.ReadyToRun.MethodGCInfoNode.MethodGCInfoNodeDeduplicatingComparer.GetHashCode(MethodGCInfoNode node)
   at System.Collections.Generic.HashSet`1.AddIfNotPresent(T value, Int32& location)
   at ILCompiler.DependencyAnalysis.ReadyToRun.MethodGCInfoNode.EncodeData(ObjectDataBuilder& dataBuilder, NodeFactory factory, Boolean relocsOnly)
   at ILCompiler.DependencyAnalysis.ArrayOfEmbeddedDataNode`1.GetElementDataForNodes(ObjectDataBuilder& builder, NodeFactory factory, Boolean relocsOnly)
   at ILCompiler.DependencyAnalysis.ArrayOfEmbeddedDataNode`1.GetData(NodeFactory factory, Boolean relocsOnly)
   at ILCompiler.DependencyAnalysis.ReadyToRunObjectWriter.EmitPortableExecutable()
   at ILCompiler.ReadyToRunCodegenCompilation.Compile(String outputFile)
   at ILCompiler.Program.RunSingleCompilation(Dictionary`2 inFilePaths, InstructionSetSupport instructionSetSupport, String compositeRootPath, Dictionary`2 unrootedInputFilePaths, HashSet`1 versionBubbleModulesHash, CompilerTypeSystemContext typeSystemContext)
   at ILCompiler.Program.Run(String[] args)
   at ILCompiler.Program.Main(String[] args)

At the same time, removed System.Runtime.dll reference works fine:

bash-3.2# /opt/usr/coreclr-tc/coreroot/corerun /opt/usr/coreclr-tc/coreroot/crossgen2/crossgen2.dll --jitpath /opt/usr/coreclr-tc/coreroot/libclrjit.so --targetarch arm64 --parallelism 4 -O  -o:/opt/usr/coreclr-tc/JIT/Regression/JitBlue/GitHub_17777/GitHub_17777/GitHub_17777.ni.dll /opt/usr/coreclr-tc/JIT/Regression/JitBlue/GitHub_17777/GitHub_17777/GitHub_17777.dll  -r:/opt/usr/coreclr-tc/coreroot/System.Private.CoreLib.dll -r:/opt/usr/coreclr-tc/JIT/Regression/JitBlue/GitHub_17777/GitHub_17777/GitHub_17777.dll
Emitting R2R PE file: /opt/usr/coreclr-tc/JIT/Regression/JitBlue/GitHub_17777/GitHub_17777/GitHub_17777.ni.dll

But if -O option is removed as well, there's another error:

Error: Failed to load assembly 'System.Runtime'
Internal.TypeSystem.TypeSystemException+FileNotFoundException: Failed to load assembly 'System.Runtime'
   at Internal.TypeSystem.ThrowHelper.ThrowFileNotFoundException(ExceptionStringID id, String fileName)
   at Internal.TypeSystem.ResolutionFailure.Throw()
   at Internal.TypeSystem.Ecma.EcmaModule.GetObject(EntityHandle handle, NotFoundBehavior notFoundBehavior)
   at Internal.TypeSystem.Ecma.EcmaModule.GetType(EntityHandle handle)
   at Internal.TypeSystem.Ecma.CustomAttributeTypeProvider.GetTypeFromReference(MetadataReader reader, TypeReferenceHandle handle, Byte rawTypeKind)
   at System.Reflection.Metadata.Ecma335.CustomAttributeDecoder`1.GetTypeFromHandle(EntityHandle handle)
   at System.Reflection.Metadata.Ecma335.CustomAttributeDecoder`1.DecodeFixedArgumentType(BlobReader& signatureReader, Boolean isElementType)
   at System.Reflection.Metadata.Ecma335.CustomAttributeDecoder`1.DecodeFixedArguments(BlobReader& signatureReader, BlobReader& valueReader, Int32 count)
   at System.Reflection.Metadata.Ecma335.CustomAttributeDecoder`1.DecodeValue(EntityHandle constructor, BlobHandle value)
   at System.Reflection.Metadata.CustomAttribute.DecodeValue[TType](ICustomAttributeTypeProvider`1 provider)
   at ILCompiler.AssemblyExtensions.HasOptimizationsDisabled(EcmaAssembly assembly)
   at ILCompiler.Program.RunSingleCompilation(Dictionary`2 inFilePaths, InstructionSetSupport instructionSetSupport, String compositeRootPath, Dictionary`2 unrootedInputFilePaths, HashSet`1 versionBubbleModulesHash, CompilerTypeSystemContext typeSystemContext)
   at ILCompiler.Program.Run(String[] args)
   at ILCompiler.Program.Main(String[] args)

With System.Runtime.dll reference and without -O option there also an error, same as the first one. This test is compiled successfully with crossgen2 on armel and x64. And this is the only test, on which we see such behavior.

cc @alpencolt

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions