From: Jan Kotas Date: Wed, 18 Nov 2020 13:00:29 +0000 (-0800) Subject: Integrate misc fixes from dotnet/runtimelab:NativeAOT (#44851) X-Git-Tag: submit/tizen/20210909.063632~4557 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1e8adf299e7f543fd548d63df3dedf574ff64e8d;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Integrate misc fixes from dotnet/runtimelab:NativeAOT (#44851) --- diff --git a/docs/workflow/editing-and-debugging.md b/docs/workflow/editing-and-debugging.md index 8297b10..5ffc981 100644 --- a/docs/workflow/editing-and-debugging.md +++ b/docs/workflow/editing-and-debugging.md @@ -15,8 +15,7 @@ more on Markdown in general. # Visual Studio Solutions -The repository has a number of Visual Studio Solutions files (`*.sln`) that are useful for editing parts of -what are in the repository. In particular +The repository has a number of Visual Studio Solutions files (`*.sln`) that are useful for editing parts of the repository. In particular * `src\coreclr\src\System.Private.CoreLib\System.Private.CorLib.sln` - This solution is for all managed (C#) code that is defined in the runtime itself. This is all class library support of one form or another. diff --git a/src/coreclr/src/inc/gcinfodecoder.h b/src/coreclr/src/inc/gcinfodecoder.h index 576b520..13b9575 100644 --- a/src/coreclr/src/inc/gcinfodecoder.h +++ b/src/coreclr/src/inc/gcinfodecoder.h @@ -42,12 +42,12 @@ typedef ArrayDPTR(const uint8_t) PTR_CBYTE; #define VALIDATE_ROOT(isInterior, hCallBack, pObjRef) -#define UINT32 UInt32 -#define INT32 Int32 -#define UINT16 UInt16 -#define UINT UInt32 -#define SIZE_T UIntNative -#define SSIZE_T IntNative +#define UINT32 uint32_t +#define INT32 int32_t +#define UINT16 uint16_t +#define UINT uint32_t +#define SIZE_T uintptr_t +#define SSIZE_T intptr_t #define LPVOID void* typedef void * OBJECTREF; diff --git a/src/coreclr/src/tools/Common/Compiler/CompilerTypeSystemContext.cs b/src/coreclr/src/tools/Common/Compiler/CompilerTypeSystemContext.cs index 3cd92b4..4499457 100644 --- a/src/coreclr/src/tools/Common/Compiler/CompilerTypeSystemContext.cs +++ b/src/coreclr/src/tools/Common/Compiler/CompilerTypeSystemContext.cs @@ -190,7 +190,7 @@ namespace ILCompiler try { PEReader peReader = OpenPEFile(filePath, out mappedViewAccessor); - pdbReader = OpenAssociatedSymbolFile(filePath, peReader); + pdbReader = PortablePdbSymbolReader.TryOpenEmbedded(peReader, GetMetadataStringDecoder()) ?? OpenAssociatedSymbolFile(filePath, peReader); EcmaModule module = EcmaModule.Create(this, peReader, containingAssembly: null, pdbReader); diff --git a/src/coreclr/src/tools/Common/TypeSystem/Common/TypeSystemHelpers.cs b/src/coreclr/src/tools/Common/TypeSystem/Common/TypeSystemHelpers.cs index a72d9a1..75a9515 100644 --- a/src/coreclr/src/tools/Common/TypeSystem/Common/TypeSystemHelpers.cs +++ b/src/coreclr/src/tools/Common/TypeSystem/Common/TypeSystemHelpers.cs @@ -369,7 +369,7 @@ namespace Internal.TypeSystem return result; } - public static bool ContainsSignatureVariables(this TypeDesc thisType) + public static bool ContainsSignatureVariables(this TypeDesc thisType, bool treatGenericParameterLikeSignatureVariable = false) { switch (thisType.Category) { @@ -377,29 +377,34 @@ namespace Internal.TypeSystem case TypeFlags.SzArray: case TypeFlags.ByRef: case TypeFlags.Pointer: - return ((ParameterizedType)thisType).ParameterType.ContainsSignatureVariables(); + return ((ParameterizedType)thisType).ParameterType.ContainsSignatureVariables(treatGenericParameterLikeSignatureVariable); case TypeFlags.FunctionPointer: MethodSignature pointerSignature = ((FunctionPointerType)thisType).Signature; for (int i = 0; i < pointerSignature.Length; i++) - if (pointerSignature[i].ContainsSignatureVariables()) + if (pointerSignature[i].ContainsSignatureVariables(treatGenericParameterLikeSignatureVariable)) return true; - return pointerSignature.ReturnType.ContainsSignatureVariables(); + return pointerSignature.ReturnType.ContainsSignatureVariables(treatGenericParameterLikeSignatureVariable); case TypeFlags.SignatureMethodVariable: case TypeFlags.SignatureTypeVariable: return true; case TypeFlags.GenericParameter: + if (treatGenericParameterLikeSignatureVariable) + return true; + // It is generally a bug to have instantiations over generic parameters + // in the system. Typical instantiations are represented as instantiations + // over own formals - so these should be signature variables instead. throw new ArgumentException(); default: Debug.Assert(thisType is DefType); foreach (TypeDesc arg in thisType.Instantiation) { - if (arg.ContainsSignatureVariables()) + if (arg.ContainsSignatureVariables(treatGenericParameterLikeSignatureVariable)) return true; } diff --git a/src/coreclr/src/tools/Common/TypeSystem/Ecma/SymbolReader/PortablePdbSymbolReader.cs b/src/coreclr/src/tools/Common/TypeSystem/Ecma/SymbolReader/PortablePdbSymbolReader.cs index 886280f..4d14480 100644 --- a/src/coreclr/src/tools/Common/TypeSystem/Ecma/SymbolReader/PortablePdbSymbolReader.cs +++ b/src/coreclr/src/tools/Common/TypeSystem/Ecma/SymbolReader/PortablePdbSymbolReader.cs @@ -7,6 +7,7 @@ using System.IO; using System.IO.MemoryMappedFiles; using System.Reflection.Metadata; using System.Reflection.Metadata.Ecma335; +using System.Reflection.PortableExecutable; using Internal.IL; @@ -74,6 +75,21 @@ namespace Internal.TypeSystem.Ecma return new PortablePdbSymbolReader(reader, mappedViewAccessor); } + public static PdbSymbolReader TryOpenEmbedded(PEReader peReader, MetadataStringDecoder stringDecoder) + { + foreach (DebugDirectoryEntry debugEntry in peReader.ReadDebugDirectory()) + { + if (debugEntry.Type != DebugDirectoryEntryType.EmbeddedPortablePdb) + continue; + + MetadataReaderProvider embeddedReaderProvider = peReader.ReadEmbeddedPortablePdbDebugDirectoryData(debugEntry); + MetadataReader reader = embeddedReaderProvider.GetMetadataReader(MetadataReaderOptions.Default, stringDecoder); + return new PortablePdbSymbolReader(reader, mappedViewAccessor: null); + } + + return null; + } + private MetadataReader _reader; private MemoryMappedViewAccessor _mappedViewAccessor; @@ -85,7 +101,8 @@ namespace Internal.TypeSystem.Ecma public override void Dispose() { - _mappedViewAccessor.Dispose(); + if (_mappedViewAccessor != null) + _mappedViewAccessor.Dispose(); } public override IEnumerable GetSequencePointsForMethod(int methodToken) diff --git a/src/coreclr/src/tools/Common/TypeSystem/IL/ILImporter.cs b/src/coreclr/src/tools/Common/TypeSystem/IL/ILImporter.cs index e3e4fba..8f4cb74 100644 --- a/src/coreclr/src/tools/Common/TypeSystem/IL/ILImporter.cs +++ b/src/coreclr/src/tools/Common/TypeSystem/IL/ILImporter.cs @@ -746,25 +746,25 @@ namespace Internal.IL ImportConvert(WellKnownType.SByte, true, false); break; case ILOpcode.conv_ovf_u1: - ImportConvert(WellKnownType.Byte, true, false); + ImportConvert(WellKnownType.Byte, true, true); break; case ILOpcode.conv_ovf_i2: ImportConvert(WellKnownType.Int16, true, false); break; case ILOpcode.conv_ovf_u2: - ImportConvert(WellKnownType.UInt16, true, false); + ImportConvert(WellKnownType.UInt16, true, true); break; case ILOpcode.conv_ovf_i4: ImportConvert(WellKnownType.Int32, true, false); break; case ILOpcode.conv_ovf_u4: - ImportConvert(WellKnownType.UInt32, true, false); + ImportConvert(WellKnownType.UInt32, true, true); break; case ILOpcode.conv_ovf_i8: ImportConvert(WellKnownType.Int64, true, false); break; case ILOpcode.conv_ovf_u8: - ImportConvert(WellKnownType.UInt64, true, false); + ImportConvert(WellKnownType.UInt64, true, true); break; case ILOpcode.refanyval: ImportRefAnyVal(ReadILToken()); @@ -779,10 +779,10 @@ namespace Internal.IL ImportLdToken(ReadILToken()); break; case ILOpcode.conv_u2: - ImportConvert(WellKnownType.UInt16, false, false); + ImportConvert(WellKnownType.UInt16, false, true); break; case ILOpcode.conv_u1: - ImportConvert(WellKnownType.Byte, false, false); + ImportConvert(WellKnownType.Byte, false, true); break; case ILOpcode.conv_i: ImportConvert(WellKnownType.IntPtr, false, false); @@ -791,7 +791,7 @@ namespace Internal.IL ImportConvert(WellKnownType.IntPtr, true, false); break; case ILOpcode.conv_ovf_u: - ImportConvert(WellKnownType.UIntPtr, true, false); + ImportConvert(WellKnownType.UIntPtr, true, true); break; case ILOpcode.add_ovf: case ILOpcode.add_ovf_un: diff --git a/src/tests/build.sh b/src/tests/build.sh index 88c7a23..a1efe50 100755 --- a/src/tests/build.sh +++ b/src/tests/build.sh @@ -440,7 +440,6 @@ build_MSBuild_projects() usage_list=() usage_list+=("-skiprestorepackages: skip package restore.") -usage_list+=("-skipstressdependencies: Don't install stress dependencies.") usage_list+=("-skipgeneratelayout: Do not generate the Core_Root layout.") usage_list+=("-skiptestwrappers: Don't generate test wrappers.")