From 5aff3becf9d9e9f3bc77ee6e3442b3ec0e3d1605 Mon Sep 17 00:00:00 2001 From: Anton Lapounov Date: Mon, 9 Mar 2020 03:15:04 -0700 Subject: [PATCH] Fix ARM64 intrinsic namespace in crossgen and crossgen2 (#32942) We did not update the hard-coded intrinsic namespace in crossgen and crossgen2 when moved ARM64 intrinsics to a different namespace. --- src/coreclr/src/tools/Common/Compiler/HardwareIntrinsicHelpers.cs | 4 ++-- .../ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs | 2 +- .../crossgen2/ILCompiler.ReadyToRun/ObjectWriter/RelocationHelper.cs | 2 +- src/coreclr/src/zap/zapinfo.cpp | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/coreclr/src/tools/Common/Compiler/HardwareIntrinsicHelpers.cs b/src/coreclr/src/tools/Common/Compiler/HardwareIntrinsicHelpers.cs index ed2d168..6bbcae8 100644 --- a/src/coreclr/src/tools/Common/Compiler/HardwareIntrinsicHelpers.cs +++ b/src/coreclr/src/tools/Common/Compiler/HardwareIntrinsicHelpers.cs @@ -22,17 +22,17 @@ namespace ILCompiler if (owningType.IsIntrinsic && owningType is MetadataType mdType) { + mdType = (MetadataType)mdType.ContainingType ?? mdType; TargetArchitecture targetArch = owningType.Context.Target.Architecture; if (targetArch == TargetArchitecture.X64 || targetArch == TargetArchitecture.X86) { - mdType = (MetadataType)mdType.ContainingType ?? mdType; if (mdType.Namespace == "System.Runtime.Intrinsics.X86") return true; } else if (targetArch == TargetArchitecture.ARM64) { - if (mdType.Namespace == "System.Runtime.Intrinsics.Arm.Arm64") + if (mdType.Namespace == "System.Runtime.Intrinsics.Arm") return true; } } diff --git a/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs b/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs index ca0842c..923ea62 100644 --- a/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs +++ b/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs @@ -1496,7 +1496,7 @@ namespace Internal.JitInterface } else if (_TARGET_ARM64_) { - fIsPlatformHWIntrinsic = (namespaceName == "System.Runtime.Intrinsics.Arm.Arm64"); + fIsPlatformHWIntrinsic = (namespaceName == "System.Runtime.Intrinsics.Arm"); } fIsHWIntrinsic = fIsPlatformHWIntrinsic || (namespaceName == "System.Runtime.Intrinsics"); diff --git a/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/ObjectWriter/RelocationHelper.cs b/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/ObjectWriter/RelocationHelper.cs index 0987481..831b706 100644 --- a/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/ObjectWriter/RelocationHelper.cs +++ b/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/ObjectWriter/RelocationHelper.cs @@ -203,7 +203,7 @@ namespace ILCompiler.PEWriter relocationLength = 4; int sourcePageRVA = sourceRVA & ~0xfff; // Page delta always fits in 21 bits as long as we use 4-byte RVAs - delta = ((targetRVA - sourcePageRVA) >> 12) & 0x1ffff; + delta = ((targetRVA - sourcePageRVA) >> 12) & 0x1f_ffff; break; } diff --git a/src/coreclr/src/zap/zapinfo.cpp b/src/coreclr/src/zap/zapinfo.cpp index ff31935..2516484 100644 --- a/src/coreclr/src/zap/zapinfo.cpp +++ b/src/coreclr/src/zap/zapinfo.cpp @@ -462,7 +462,7 @@ void ZapInfo::CompileMethod() const char* namespaceName; getMethodNameFromMetadata(m_currentMethodHandle, nullptr, &namespaceName, nullptr); if (strcmp(namespaceName, "System.Runtime.Intrinsics.X86") == 0 - || strcmp(namespaceName, "System.Runtime.Intrinsics.Arm.Arm64") == 0 + || strcmp(namespaceName, "System.Runtime.Intrinsics.Arm") == 0 || strcmp(namespaceName, "System.Runtime.Intrinsics") == 0) { if (m_zapper->m_pOpt->m_verbose) @@ -2121,7 +2121,7 @@ DWORD FilterNamedIntrinsicMethodAttribs(ZapInfo* pZapInfo, DWORD attribs, CORINF #if defined(TARGET_X86) || defined(TARGET_AMD64) fIsPlatformHWIntrinsic = strcmp(namespaceName, "System.Runtime.Intrinsics.X86") == 0; #elif TARGET_ARM64 - fIsPlatformHWIntrinsic = strcmp(namespaceName, "System.Runtime.Intrinsics.Arm.Arm64") == 0; + fIsPlatformHWIntrinsic = strcmp(namespaceName, "System.Runtime.Intrinsics.Arm") == 0; #endif fIsHWIntrinsic = fIsPlatformHWIntrinsic || (strcmp(namespaceName, "System.Runtime.Intrinsics") == 0); -- 2.7.4