Removing IsSIMDVectorAssembly and obsoleting isInSIMDModule (dotnet/coreclr#27467)
authorTanner Gooding <tagoo@outlook.com>
Sun, 27 Oct 2019 06:48:05 +0000 (23:48 -0700)
committerJan Kotas <jkotas@microsoft.com>
Sun, 27 Oct 2019 06:48:05 +0000 (23:48 -0700)
* Removing IsSIMDVectorAssembly from the VM layer

* Removing SimdHelper from crossgen2

* Obsoleting isInSIMDModule in the VM layer

* Renaming isInSIMDModule to isIntrinsicType

* Implementing isIntrinsicType for the JIT/EE interface

* Update JITEEVersionIdentifier

* Update crossgen2 JITEEVersionIdentifier

Commit migrated from https://github.com/dotnet/coreclr/commit/ca6c03eed7d38819b8b093b7ee6098a4c69cd6c8

29 files changed:
src/coreclr/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h
src/coreclr/src/ToolBox/superpmi/superpmi-shared/lwmlist.h
src/coreclr/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp
src/coreclr/src/ToolBox/superpmi/superpmi-shared/methodcontext.h
src/coreclr/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp
src/coreclr/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp
src/coreclr/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp
src/coreclr/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp
src/coreclr/src/inc/corinfo.h
src/coreclr/src/jit/ICorJitInfo_API_names.h
src/coreclr/src/jit/ICorJitInfo_API_wrapper.hpp
src/coreclr/src/jit/compiler.h
src/coreclr/src/tools/crossgen2/Common/Compiler/CompilerTypeSystemContext.cs
src/coreclr/src/tools/crossgen2/Common/Compiler/SimdHelper.cs [deleted file]
src/coreclr/src/tools/crossgen2/Common/JitInterface/CorInfoBase.cs
src/coreclr/src/tools/crossgen2/Common/JitInterface/CorInfoImpl.cs
src/coreclr/src/tools/crossgen2/Common/JitInterface/ThunkGenerator/ThunkInput.txt
src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/Compiler/ReadyToRunCompilerContext.cs
src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj
src/coreclr/src/tools/crossgen2/jitinterface/jitinterface.h
src/coreclr/src/tools/crossgen2/jitinterface/jitwrapper.cpp
src/coreclr/src/vm/assembly.cpp
src/coreclr/src/vm/assembly.hpp
src/coreclr/src/vm/interpreter.cpp
src/coreclr/src/vm/jitinterface.cpp
src/coreclr/src/vm/jitinterface.h
src/coreclr/src/vm/methodtablebuilder.cpp
src/coreclr/src/zap/zapinfo.cpp
src/coreclr/src/zap/zapinfo.h

index 61d70a2..6d5602f 100644 (file)
@@ -144,9 +144,8 @@ void expandRawHandleIntrinsic(
 // *pMustExpand tells whether or not JIT must expand the intrinsic.
 CorInfoIntrinsics getIntrinsicID(CORINFO_METHOD_HANDLE method, bool* pMustExpand = NULL /* OUT */);
 
-// Is the given module the System.Numerics.Vectors module?
-// This defaults to false.
-bool isInSIMDModule(CORINFO_CLASS_HANDLE classHnd); /* { return false; } */
+// Is the given type in System.Private.Corelib and marked with IntrinsicAttribute?
+bool isIntrinsicType(CORINFO_CLASS_HANDLE classHnd);
 
 // return the unmanaged calling convention for a PInvoke
 CorInfoUnmanagedCallConv getUnmanagedCallConv(CORINFO_METHOD_HANDLE method);
index 36b8469..45449d1 100644 (file)
@@ -142,7 +142,7 @@ LWM(InitConstraintsForVerification, DWORDLONG, DD)
 LWM(IsCompatibleDelegate, Agnostic_IsCompatibleDelegate, DD)
 LWM(IsDelegateCreationAllowed, DLDL, DWORD)
 LWM(IsFieldStatic, DWORDLONG, DWORD)
-LWM(IsInSIMDModule, DWORDLONG, DWORD)
+LWM(IsIntrinsicType, DWORDLONG, DWORD)
 LWM(IsInstantiationOfVerifiedGeneric, DWORDLONG, DWORD)
 LWM(IsSDArray, DWORDLONG, DWORD)
 LWM(IsStructRequiringStackAllocRetBuf, DWORDLONG, DWORD)
index 53c882e..12041dd 100644 (file)
@@ -1577,25 +1577,25 @@ CorInfoIntrinsics MethodContext::repGetIntrinsicID(CORINFO_METHOD_HANDLE method,
     return result;
 }
 
-void MethodContext::recIsInSIMDModule(CORINFO_CLASS_HANDLE cls, BOOL result)
+void MethodContext::recIsIntrinsicType(CORINFO_CLASS_HANDLE cls, BOOL result)
 {
-    if (IsInSIMDModule == nullptr)
-        IsInSIMDModule = new LightWeightMap<DWORDLONG, DWORD>();
+    if (IsIntrinsicType == nullptr)
+        IsIntrinsicType = new LightWeightMap<DWORDLONG, DWORD>();
 
-    IsInSIMDModule->Add((DWORDLONG)cls, (DWORD)result);
-    DEBUG_REC(dmpIsInSIMDModule((DWORDLONG)cls, (DWORD)result));
+    IsIntrinsicType->Add((DWORDLONG)cls, (DWORD)result);
+    DEBUG_REC(dmpIsIntrinsicType((DWORDLONG)cls, (DWORD)result));
 }
-void MethodContext::dmpIsInSIMDModule(DWORDLONG key, DWORD value)
+void MethodContext::dmpIsIntrinsicType(DWORDLONG key, DWORD value)
 {
-    printf("IsInSIMDModule key mth-%016llX, value intr-%u", key, value);
+    printf("IsIntrinsicType key mth-%016llX, value intr-%u", key, value);
 }
-BOOL MethodContext::repIsInSIMDModule(CORINFO_CLASS_HANDLE cls)
+BOOL MethodContext::repIsIntrinsicType(CORINFO_CLASS_HANDLE cls)
 {
-    AssertCodeMsg(IsInSIMDModule != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX", (DWORDLONG)cls);
-    AssertCodeMsg(IsInSIMDModule->GetIndex((DWORDLONG)cls) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX",
+    AssertCodeMsg(IsIntrinsicType != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX", (DWORDLONG)cls);
+    AssertCodeMsg(IsIntrinsicType->GetIndex((DWORDLONG)cls) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX",
                   (DWORDLONG)cls);
-    BOOL result = (BOOL)IsInSIMDModule->Get((DWORDLONG)cls);
-    DEBUG_REP(dmpIsInSIMDModule((DWORDLONG)cls, (DWORD)result));
+    BOOL result = (BOOL)IsIntrinsicType->Get((DWORDLONG)cls);
+    DEBUG_REP(dmpIsIntrinsicType((DWORDLONG)cls, (DWORD)result));
     return result;
 }
 
index a312fdd..1b63611 100644 (file)
@@ -769,9 +769,9 @@ public:
     void dmpIsSDArray(DWORDLONG key, DWORD value);
     BOOL repIsSDArray(CORINFO_CLASS_HANDLE cls);
 
-    void recIsInSIMDModule(CORINFO_CLASS_HANDLE cls, BOOL result);
-    void dmpIsInSIMDModule(DWORDLONG key, DWORD value);
-    BOOL repIsInSIMDModule(CORINFO_CLASS_HANDLE cls);
+    void recIsIntrinsicType(CORINFO_CLASS_HANDLE cls, BOOL result);
+    void dmpIsIntrinsicType(DWORDLONG key, DWORD value);
+    BOOL repIsIntrinsicType(CORINFO_CLASS_HANDLE cls);
 
     void recGetFieldClass(CORINFO_FIELD_HANDLE field, CORINFO_CLASS_HANDLE result);
     void dmpGetFieldClass(DWORDLONG key, DWORDLONG value);
@@ -1488,7 +1488,7 @@ enum mcPackets
     Packet_IsCompatibleDelegate                          = 99,
     Packet_IsDelegateCreationAllowed                     = 155,
     Packet_IsFieldStatic                                 = 137, // Added 4/9/2013 - needed for 4.5.1
-    Packet_IsInSIMDModule                                = 148, // Added 6/18/2014 - SIMD support
+    Packet_IsIntrinsicType                               = 148, // Added 10/26/2019 - SIMD support
     Packet_IsInstantiationOfVerifiedGeneric              = 100,
     Packet_IsSDArray                                     = 101,
     Packet_IsStructRequiringStackAllocRetBuf             = 102,
index 0d41b10..b2ead48 100644 (file)
@@ -284,12 +284,12 @@ CorInfoIntrinsics interceptor_ICJI::getIntrinsicID(CORINFO_METHOD_HANDLE method,
     return temp;
 }
 
-// Is the given module the System.Numerics.Vectors module?
-bool interceptor_ICJI::isInSIMDModule(CORINFO_CLASS_HANDLE classHnd)
+// Is the given type in System.Private.Corelib and marked with IntrinsicAttribute?
+bool interceptor_ICJI::isIntrinsicType(CORINFO_CLASS_HANDLE classHnd)
 {
-    mc->cr->AddCall("isInSIMDModule");
-    bool temp = original_ICorJitInfo->isInSIMDModule(classHnd);
-    mc->recIsInSIMDModule(classHnd, temp);
+    mc->cr->AddCall("isIntrinsicType");
+    bool temp = original_ICorJitInfo->isIntrinsicType(classHnd);
+    mc->recIsIntrinsicType(classHnd, temp);
     return temp;
 }
 
index 587aeec..7ffa1eb 100644 (file)
@@ -194,11 +194,11 @@ CorInfoIntrinsics interceptor_ICJI::getIntrinsicID(CORINFO_METHOD_HANDLE method,
     return original_ICorJitInfo->getIntrinsicID(method, pMustExpand);
 }
 
-// Is the given module the System.Numerics.Vectors module?
-bool interceptor_ICJI::isInSIMDModule(CORINFO_CLASS_HANDLE classHnd)
+// Is the given type in System.Private.Corelib and marked with IntrinsicAttribute?
+bool interceptor_ICJI::isIntrinsicType(CORINFO_CLASS_HANDLE classHnd)
 {
-    mcs->AddCall("isInSIMDModule");
-    return original_ICorJitInfo->isInSIMDModule(classHnd);
+    mcs->AddCall("isIntrinsicType");
+    return original_ICorJitInfo->isIntrinsicType(classHnd);
 }
 
 // return the unmanaged calling convention for a PInvoke
index e33d9e6..f390fcb 100644 (file)
@@ -177,10 +177,10 @@ CorInfoIntrinsics interceptor_ICJI::getIntrinsicID(CORINFO_METHOD_HANDLE method,
     return original_ICorJitInfo->getIntrinsicID(method, pMustExpand);
 }
 
-// Is the given module the System.Numerics.Vectors module?
-bool interceptor_ICJI::isInSIMDModule(CORINFO_CLASS_HANDLE classHnd)
+// Is the given type in System.Private.Corelib and marked with IntrinsicAttribute?
+bool interceptor_ICJI::isIntrinsicType(CORINFO_CLASS_HANDLE classHnd)
 {
-    return original_ICorJitInfo->isInSIMDModule(classHnd);
+    return original_ICorJitInfo->isIntrinsicType(classHnd);
 }
 
 // return the unmanaged calling convention for a PInvoke
index 2ced2d8..bf143b8 100644 (file)
@@ -218,11 +218,11 @@ CorInfoIntrinsics MyICJI::getIntrinsicID(CORINFO_METHOD_HANDLE method, bool* pMu
     return jitInstance->mc->repGetIntrinsicID(method, pMustExpand);
 }
 
-// Is the given module the System.Numerics.Vectors module?
-bool MyICJI::isInSIMDModule(CORINFO_CLASS_HANDLE classHnd)
+// Is the given type in System.Private.Corelib and marked with IntrinsicAttribute?
+bool MyICJI::isIntrinsicType(CORINFO_CLASS_HANDLE classHnd)
 {
-    jitInstance->mc->cr->AddCall("isInSIMDModule");
-    return jitInstance->mc->repIsInSIMDModule(classHnd) ? true : false;
+    jitInstance->mc->cr->AddCall("isIntrinsicType");
+    return jitInstance->mc->repIsIntrinsicType(classHnd) ? true : false;
 }
 
 // return the unmanaged calling convention for a PInvoke
index 91a8136..63d05aa 100644 (file)
@@ -217,11 +217,11 @@ TODO: Talk about initializing strutures before use
 #endif
 #endif
 
-SELECTANY const GUID JITEEVersionIdentifier = { /* 1ce51eeb-dfd0-4450-ba2c-ea0d2d863df5 */
-    0x1ce51eeb,
-    0xdfd0,
-    0x4450,
-    {0xba, 0x2c, 0xea, 0x0d, 0x2d, 0x86, 0x3d, 0xf5}
+SELECTANY const GUID JITEEVersionIdentifier = { /* aec2498a-ca70-408e-903e-1e6d84e90bd2 */
+    0xaec2498a,
+    0xca70,
+    0x408e,
+    {0x90, 0x3e, 0x1e, 0x6d, 0x84, 0xe9, 0x0b, 0xd2}
 };
 
 //////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -2171,9 +2171,9 @@ public:
             bool*                       pMustExpand = NULL      /* OUT */
             ) = 0;
 
-    // Is the given module the System.Numerics.Vectors module?
+    // Is the given type in System.Private.Corelib and marked with IntrinsicAttribute?
     // This defaults to false.
-    virtual bool isInSIMDModule(
+    virtual bool isIntrinsicType(
             CORINFO_CLASS_HANDLE        classHnd
             ) { return false; }
 
index 3a287f8..7a587f8 100644 (file)
@@ -15,7 +15,7 @@ DEF_CLR_API(getMethodClass)
 DEF_CLR_API(getMethodModule)
 DEF_CLR_API(getMethodVTableOffset)
 DEF_CLR_API(getIntrinsicID)
-DEF_CLR_API(isInSIMDModule)
+DEF_CLR_API(isIntrinsicType)
 DEF_CLR_API(getUnmanagedCallConv)
 DEF_CLR_API(pInvokeMarshalingRequired)
 DEF_CLR_API(satisfiesMethodConstraints)
index 758c189..6fe2200 100644 (file)
@@ -140,11 +140,11 @@ CorInfoIntrinsics WrapICorJitInfo::getIntrinsicID(
     return temp;
 }
 
-bool WrapICorJitInfo::isInSIMDModule(CORINFO_CLASS_HANDLE classHnd)
+bool WrapICorJitInfo::isIntrinsicType(CORINFO_CLASS_HANDLE classHnd)
 {
-    API_ENTER(isInSIMDModule);
-    bool temp = wrapHnd->isInSIMDModule(classHnd);
-    API_LEAVE(isInSIMDModule);
+    API_ENTER(isIntrinsicType);
+    bool temp = wrapHnd->isIntrinsicType(classHnd);
+    API_LEAVE(isIntrinsicType);
     return temp;
 }
 
index d989863..2579864 100644 (file)
@@ -7770,12 +7770,18 @@ private:
 
     bool isSIMDClass(CORINFO_CLASS_HANDLE clsHnd)
     {
-        return info.compCompHnd->isInSIMDModule(clsHnd);
+        if (isIntrinsicType(clsHnd))
+        {
+            const char* namespaceName = nullptr;
+            (void)getClassNameFromMetadata(clsHnd, &namespaceName);
+            return strcmp(namespaceName, "System.Numerics") == 0;
+        }
+        return false;
     }
 
     bool isIntrinsicType(CORINFO_CLASS_HANDLE clsHnd)
     {
-        return (info.compCompHnd->getClassAttribs(clsHnd) & CORINFO_FLG_INTRINSIC_TYPE) != 0;
+        return info.compCompHnd->isIntrinsicType(clsHnd);
     }
 
     const char* getClassNameFromMetadata(CORINFO_CLASS_HANDLE cls, const char** namespaceName)
index 0203ce7..7463ec7 100644 (file)
@@ -20,8 +20,6 @@ namespace ILCompiler
         private readonly MetadataRuntimeInterfacesAlgorithm _metadataRuntimeInterfacesAlgorithm = new MetadataRuntimeInterfacesAlgorithm();
         private readonly MetadataVirtualMethodAlgorithm _virtualMethodAlgorithm = new MetadataVirtualMethodAlgorithm();
 
-        protected SimdHelper _simdHelper;
-        
         private MetadataStringDecoder _metadataStringDecoder;
 
         private class ModuleData
diff --git a/src/coreclr/src/tools/crossgen2/Common/Compiler/SimdHelper.cs b/src/coreclr/src/tools/crossgen2/Common/Compiler/SimdHelper.cs
deleted file mode 100644 (file)
index a8550b7..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Collections.Generic;
-
-using Internal.TypeSystem;
-
-using AssemblyName = System.Reflection.AssemblyName;
-
-namespace ILCompiler
-{
-    /// <summary>
-    /// Helper type that deals with System.Numerics.Vectors intrinsics.
-    /// </summary>
-    public struct SimdHelper
-    {
-        private ModuleDesc[] _simdModulesCached;
-
-        public bool IsSimdType(TypeDesc type)
-        {
-            if (type is MetadataType metadataType)
-            {
-                if (_simdModulesCached == null)
-                {
-                    InitializeSimdModules(type);
-                }
-
-                ModuleDesc typeModule = metadataType.Module;
-                foreach (ModuleDesc simdModule in _simdModulesCached)
-                    if (typeModule == simdModule)
-                        return true;
-
-                if (metadataType.IsIntrinsic)
-                {
-                    string name = metadataType.Name;
-                    if (((name == "Vector") || (name == "Vector`1") || (name == "Vector2") || (name == "Vector3") || (name == "Vector4")) &&
-                        (metadataType.Namespace == "System.Numerics"))
-                        return true;
-                }
-            }
-
-            return false;
-        }
-
-        private void InitializeSimdModules(TypeDesc type)
-        {
-            TypeSystemContext context = type.Context;
-
-            ArrayBuilder<ModuleDesc> simdModules = new ArrayBuilder<ModuleDesc>();
-
-            ModuleDesc module = context.ResolveAssembly(new AssemblyName("System.Numerics"), false);
-            if (module != null)
-                simdModules.Add(module);
-
-            module = context.ResolveAssembly(new AssemblyName("System.Numerics.Vectors"), false);
-            if (module != null)
-                simdModules.Add(module);
-
-            _simdModulesCached = simdModules.ToArray();
-        }
-
-        public bool IsVectorOfT(TypeDesc type)
-        {
-            return IsSimdType(type)
-                && ((MetadataType)type).Name == "Vector`1"
-                && ((MetadataType)type).Namespace == "System.Numerics";
-        }
-    }
-}
index c092c45..1aa42f3 100644 (file)
@@ -46,7 +46,7 @@ namespace Internal.JitInterface
         [UnmanagedFunctionPointerAttribute(default(CallingConvention))]
         delegate CorInfoIntrinsics __getIntrinsicID(IntPtr _this, IntPtr* ppException, CORINFO_METHOD_STRUCT_* method, byte* pMustExpand);
         [UnmanagedFunctionPointerAttribute(default(CallingConvention))]
-        [return: MarshalAs(UnmanagedType.I1)]delegate bool __isInSIMDModule(IntPtr _this, IntPtr* ppException, CORINFO_CLASS_STRUCT_* classHnd);
+        [return: MarshalAs(UnmanagedType.I1)]delegate bool __isIntrinsicType(IntPtr _this, IntPtr* ppException, CORINFO_CLASS_STRUCT_* classHnd);
         [UnmanagedFunctionPointerAttribute(default(CallingConvention))]
         delegate CorInfoUnmanagedCallConv __getUnmanagedCallConv(IntPtr _this, IntPtr* ppException, CORINFO_METHOD_STRUCT_* method);
         [UnmanagedFunctionPointerAttribute(default(CallingConvention))]
@@ -601,12 +601,12 @@ namespace Internal.JitInterface
             }
         }
 
-        [return: MarshalAs(UnmanagedType.I1)]static bool _isInSIMDModule(IntPtr thisHandle, IntPtr* ppException, CORINFO_CLASS_STRUCT_* classHnd)
+        [return: MarshalAs(UnmanagedType.I1)]static bool _isIntrinsicType(IntPtr thisHandle, IntPtr* ppException, CORINFO_CLASS_STRUCT_* classHnd)
         {
             var _this = GetThis(thisHandle);
             try
             {
-                return _this.isInSIMDModule(classHnd);
+                return _this.isIntrinsicType(classHnd);
             }
             catch (Exception ex)
             {
@@ -2887,7 +2887,7 @@ namespace Internal.JitInterface
             var d16 = new __getIntrinsicID(_getIntrinsicID);
             callbacks[16] = Marshal.GetFunctionPointerForDelegate(d16);
             delegates[16] = d16;
-            var d17 = new __isInSIMDModule(_isInSIMDModule);
+            var d17 = new __isIntrinsicType(_isIntrinsicType);
             callbacks[17] = Marshal.GetFunctionPointerForDelegate(d17);
             delegates[17] = d17;
             var d18 = new __getUnmanagedCallConv(_getUnmanagedCallConv);
index b895a8a..d09b12b 100644 (file)
@@ -885,29 +885,10 @@ namespace Internal.JitInterface
             return comparer != null ? ObjectToHandle(comparer) : null;
         }
 
-        private SimdHelper _simdHelper;
-        private bool isInSIMDModule(CORINFO_CLASS_STRUCT_* classHnd)
+        private bool isIntrinsicType(CORINFO_CLASS_STRUCT_* classHnd)
         {
             TypeDesc type = HandleToObject(classHnd);
-            
-            if (_simdHelper.IsSimdType(type))
-            {
-#if DEBUG
-                // If this is Vector<T>, make sure the codegen and the type system agree on what instructions/registers
-                // we're generating code for.
-
-                CORJIT_FLAGS flags = default(CORJIT_FLAGS);
-                getJitFlags(ref flags, (uint)sizeof(CORJIT_FLAGS));
-
-                Debug.Assert(!_simdHelper.IsVectorOfT(type)
-                    || ((DefType)type).InstanceFieldSize.IsIndeterminate /* This would happen in the ReadyToRun case */
-                    || ((DefType)type).InstanceFieldSize.AsInt == GetMaxIntrinsicSIMDVectorLength(_jit, &flags));
-#endif
-
-                return true;
-            }
-
-            return false;
+            return type.IsIntrinsic;
         }
 
         private CorInfoUnmanagedCallConv getUnmanagedCallConv(CORINFO_METHOD_STRUCT_* method)
index f4fd347..fffc0de 100644 (file)
@@ -180,7 +180,7 @@ FUNCTIONS
     CORINFO_CLASS_HANDLE getDefaultEqualityComparerClass(CORINFO_CLASS_HANDLE elemType);
     void expandRawHandleIntrinsic(CORINFO_RESOLVED_TOKEN *        pResolvedToken, CORINFO_GENERICHANDLE_RESULT *  pResult);
     CorInfoIntrinsics getIntrinsicID(        CORINFO_METHOD_HANDLE       method        , BoolStar pMustExpand);
-    bool isInSIMDModule(           CORINFO_CLASS_HANDLE        classHnd );
+    bool isIntrinsicType(           CORINFO_CLASS_HANDLE        classHnd );
     CorInfoUnmanagedCallConv getUnmanagedCallConv(        CORINFO_METHOD_HANDLE       method        );
     BOOL pInvokeMarshalingRequired(        CORINFO_METHOD_HANDLE       method,        CORINFO_SIG_INFO*           callSiteSig        );
     BOOL satisfiesMethodConstraints(        CORINFO_CLASS_HANDLE        parent,        CORINFO_METHOD_HANDLE       method        );
index 61dc419..5ffa4e5 100644 (file)
@@ -45,7 +45,7 @@ namespace ILCompiler
                 throw new NotImplementedException();
             else if (type.IsRuntimeDeterminedType)
                 throw new NotImplementedException();
-            else if (_simdHelper.IsVectorOfT(type))
+            else if (type.IsIntrinsic && (type.Name == "Vector`1") && (type.Namespace == "System.Numerics"))
             {
                 return _vectorFieldLayoutAlgorithm;
             }
index 7f46c38..e36cc91 100644 (file)
@@ -89,7 +89,6 @@
     <Compile Include="..\Common\Compiler\InternalCompilerErrorException.cs" Link="Compiler\InternalCompilerErrorException.cs" />
     <Compile Include="..\Common\Compiler\NameMangler.cs" Link="Compiler\NameMangler.cs" />
     <Compile Include="..\Common\Compiler\ReadyToRun.cs" Link="Compiler\ReadyToRun.cs" />
-    <Compile Include="..\Common\Compiler\SimdHelper.cs" Link="Compiler\SimdHelper.cs" />
     <Compile Include="..\Common\Compiler\SingleMethodRootProvider.cs" Link="Compiler\SingleMethodRootProvider.cs" />
     <Compile Include="..\Common\Compiler\TypeExtensions.cs" Link="Compiler\TypeExtensions.cs" />
     <Compile Include="..\Common\Compiler\VectorFieldLayoutAlgorithm.cs" Link="Compiler\VectorFieldLayoutAlgorithm.cs" />
index 3b59c54..96ea074 100644 (file)
@@ -27,7 +27,7 @@ struct JitInterfaceCallbacks
     void* (* getDefaultEqualityComparerClass)(void * thisHandle, CorInfoException** ppException, void* elemType);
     void (* expandRawHandleIntrinsic)(void * thisHandle, CorInfoException** ppException, void* pResolvedToken, void* pResult);
     int (* getIntrinsicID)(void * thisHandle, CorInfoException** ppException, void* method, bool* pMustExpand);
-    bool (* isInSIMDModule)(void * thisHandle, CorInfoException** ppException, void* classHnd);
+    bool (* isIntrinsicType)(void * thisHandle, CorInfoException** ppException, void* classHnd);
     int (* getUnmanagedCallConv)(void * thisHandle, CorInfoException** ppException, void* method);
     int (* pInvokeMarshalingRequired)(void * thisHandle, CorInfoException** ppException, void* method, void* callSiteSig);
     int (* satisfiesMethodConstraints)(void * thisHandle, CorInfoException** ppException, void* parent, void* method);
@@ -349,10 +349,10 @@ public:
         return _ret;
     }
 
-    virtual bool isInSIMDModule(void* classHnd)
+    virtual bool isIntrinsicType(void* classHnd)
     {
         CorInfoException* pException = nullptr;
-        bool _ret = _callbacks->isInSIMDModule(_thisHandle, &pException, classHnd);
+        bool _ret = _callbacks->isIntrinsicType(_thisHandle, &pException, classHnd);
         if (pException != nullptr)
             throw pException;
         return _ret;
index 6e67409..ada2b05 100644 (file)
@@ -27,11 +27,11 @@ private:
     uint64_t corJitFlags;
 };
 
-static const GUID JITEEVersionIdentifier = { /* 1ce51eeb-dfd0-4450-ba2c-ea0d2d863df5 */
-    0x1ce51eeb,
-    0xdfd0,
-    0x4450,
-    {0xba, 0x2c, 0xea, 0x0d, 0x2d, 0x86, 0x3d, 0xf5}
+static const GUID JITEEVersionIdentifier = { /* aec2498a-ca70-408e-903e-1e6d84e90bd2 */
+    0xaec2498a,
+    0xca70,
+    0x408e,
+    {0x90, 0x3e, 0x1e, 0x6d, 0x84, 0xe9, 0x0b, 0xd2}
 };
 
 class Jit
index ede9372..aa199a0 100644 (file)
@@ -190,22 +190,6 @@ void Assembly::Init(AllocMemTracker *pamTracker, LoaderAllocator *pLoaderAllocat
     if (!m_pManifest->IsReadyToRun())
         CacheManifestExportedTypes(pamTracker);
 
-
-    // Check for the assemblies that contain SIMD Vector types.
-    // If we encounter a non-trusted assembly with these names, we will simply not recognize any of its
-    // methods as intrinsics.
-    LPCUTF8 assemblyName = GetSimpleName();
-    const int length = sizeof("System.Numerics") - 1;
-    if ((strncmp(assemblyName, "System.Numerics", length) == 0) &&
-        ((assemblyName[length] == '\0') || (strcmp(assemblyName+length, ".Vectors") == 0)))
-    {
-        m_fIsSIMDVectorAssembly = true;
-    }
-    else
-    {
-        m_fIsSIMDVectorAssembly = false;
-    }
-
     // We'll load the friend assembly information lazily.  For the ngen case we should avoid
     //  loading it entirely.
     //CacheFriendAssemblyInfo();
index e4b0795..09a005c 100644 (file)
@@ -439,8 +439,6 @@ public:
     OBJECTHANDLE GetLoaderAllocatorObjectHandle() { WRAPPER_NO_CONTRACT; return GetLoaderAllocator()->GetLoaderAllocatorObjectHandle(); }
 #endif // FEATURE_COLLECTIBLE_TYPES
 
-    BOOL IsSIMDVectorAssembly() { LIMITED_METHOD_DAC_CONTRACT; return m_fIsSIMDVectorAssembly; }
-
 #if defined(FEATURE_PREJIT) || defined(FEATURE_READYTORUN)
     BOOL IsInstrumented();
     BOOL IsInstrumentedHelper();
@@ -617,8 +615,6 @@ private:
 
     BOOL                  m_fTerminated;
 
-    BOOL                  m_fIsSIMDVectorAssembly;
-
 #if defined(FEATURE_PREJIT) || defined(FEATURE_READYTORUN)
     enum IsInstrumentedStatus {
         IS_INSTRUMENTED_UNSET = 0,
index 8dcdacf..2612734 100644 (file)
@@ -9050,15 +9050,15 @@ void Interpreter::DoCallWork(bool virtualCall, void* thisArg, CORINFO_RESOLVED_T
             // Check for the simd class...
             assert(exactClass != NULL);
             GCX_PREEMP();
-            bool isSIMD = m_interpCeeInfo.isInSIMDModule(exactClass);
+            bool isIntrinsicType = m_interpCeeInfo.isIntrinsicType(exactClass);
 
-            if (isSIMD)
+            if (isIntrinsicType)
             {
                 // SIMD intrinsics are recognized by name.
                 const char* namespaceName = NULL;
                 const char* className = NULL;
                 const char* methodName = m_interpCeeInfo.getMethodNameFromMetadata((CORINFO_METHOD_HANDLE)methToCall, &className, &namespaceName, NULL);
-                if (strcmp(methodName, "get_IsHardwareAccelerated") == 0)
+                if ((strcmp(methodName, "get_IsHardwareAccelerated") == 0) && (strcmp(className, "Vector") == 0) && (strcmp(namespaceName, "System.Numerics") == 0))
                 {
                     GCX_COOP();
                     DoSIMDHwAccelerated();
index c7588fb..a718972 100644 (file)
@@ -8947,10 +8947,9 @@ CorInfoIntrinsics CEEInfo::getIntrinsicID(CORINFO_METHOD_HANDLE methodHnd,
 }
 
 /*********************************************************************/
-// TODO: This method should probably be renamed to something like "isSIMDType"
-bool CEEInfo::isInSIMDModule(CORINFO_CLASS_HANDLE classHnd)
+bool CEEInfo::isIntrinsicType(CORINFO_CLASS_HANDLE classHnd)
 {
-CONTRACTL {
+    CONTRACTL {
         NOTHROW;
         GC_NOTRIGGER;
         MODE_PREEMPTIVE;
@@ -8961,28 +8960,9 @@ CONTRACTL {
 
     TypeHandle VMClsHnd(classHnd);
     PTR_MethodTable methodTable = VMClsHnd.GetMethodTable();
-    if (methodTable->GetAssembly()->IsSIMDVectorAssembly())
-    {
-        result = true;
-    }
-    else if (methodTable->IsIntrinsicType())
-    {
-        LPCUTF8 namespaceName;
-        LPCUTF8 className = methodTable->GetFullyQualifiedNameInfo(&namespaceName);
-
-        if (strncmp(className, "Vector", 6) == 0)
-        {
-            className += 6;
+    result = methodTable->IsIntrinsicType();
 
-            if ((className[0] == '\0') || (strcmp(className, "`1") == 0) || (strcmp(className, "2") == 0) || (strcmp(className, "3") == 0) || (strcmp(className, "4") == 0))
-            {
-                assert(strcmp(namespaceName, "System.Numerics") == 0);
-                result = true;
-            }
-        }
-    }
     EE_TO_JIT_TRANSITION_LEAF();
-
     return result;
 }
 
index c56f82d..f5a694f 100644 (file)
@@ -822,7 +822,7 @@ public:
     CorInfoIntrinsics getIntrinsicID(CORINFO_METHOD_HANDLE method,
                                      bool * pMustExpand = NULL);
 
-    bool isInSIMDModule(CORINFO_CLASS_HANDLE classHnd);
+    bool isIntrinsicType(CORINFO_CLASS_HANDLE classHnd);
 
     CorInfoUnmanagedCallConv getUnmanagedCallConv(CORINFO_METHOD_HANDLE method);
     BOOL pInvokeMarshalingRequired(CORINFO_METHOD_HANDLE method, CORINFO_SIG_INFO* callSiteSig);
index b332530..b8b0956 100644 (file)
@@ -1163,7 +1163,7 @@ BOOL MethodTableBuilder::CheckIfSIMDAndUpdateSize()
     STANDARD_VM_CONTRACT;
 
 #if defined(_TARGET_X86_) || defined(_TARGET_AMD64_)
-    if (!(GetAssembly()->IsSIMDVectorAssembly() || bmtProp->fIsIntrinsicType))
+    if (!bmtProp->fIsIntrinsicType)
         return false;
 
     if (bmtFP->NumInstanceFieldBytes != 16)
@@ -1485,7 +1485,7 @@ MethodTableBuilder::BuildMethodTableThrowing(
     // SIMD types have [Intrinsic] attribute, for example
     //
     // We check this here fairly early to ensure other downstream checks on these types can be slightly more efficient.
-    if (GetModule()->IsSystem() || GetAssembly()->IsSIMDVectorAssembly())
+    if (GetModule()->IsSystem())
     {
         HRESULT hr = GetCustomAttribute(bmtInternal->pType->GetTypeDefToken(),
             WellKnownAttribute::Intrinsic,
@@ -5134,7 +5134,7 @@ MethodTableBuilder::InitNewMethodDesc(
     }
 
     // Check for methods marked as [Intrinsic]
-    if (GetModule()->IsSystem() || GetAssembly()->IsSIMDVectorAssembly())
+    if (GetModule()->IsSystem())
     {
         if (bmtProp->fIsHardwareIntrinsic || (S_OK == GetCustomAttribute(pMethod->GetMethodSignature().GetToken(),
                                                     WellKnownAttribute::Intrinsic,
index 756e266..8718db2 100644 (file)
@@ -4017,9 +4017,9 @@ CorInfoIntrinsics ZapInfo::getIntrinsicID(CORINFO_METHOD_HANDLE method,
     return intrinsicID;
 }
 
-bool ZapInfo::isInSIMDModule(CORINFO_CLASS_HANDLE classHnd)
+bool ZapInfo::isIntrinsicType(CORINFO_CLASS_HANDLE classHnd)
 {
-    return m_pEEJitInfo->isInSIMDModule(classHnd);
+    return m_pEEJitInfo->isIntrinsicType(classHnd);
 }
 
 CorInfoUnmanagedCallConv ZapInfo::getUnmanagedCallConv(CORINFO_METHOD_HANDLE method)
index c05cd6f..fbfe573 100644 (file)
@@ -707,7 +707,7 @@ public:
 
     CorInfoIntrinsics getIntrinsicID(CORINFO_METHOD_HANDLE method,
                                      bool * pMustExpand = NULL);
-    bool isInSIMDModule(CORINFO_CLASS_HANDLE classHnd);
+    bool isIntrinsicType(CORINFO_CLASS_HANDLE classHnd);
     CorInfoUnmanagedCallConv getUnmanagedCallConv(CORINFO_METHOD_HANDLE method);
     BOOL pInvokeMarshalingRequired(CORINFO_METHOD_HANDLE method, CORINFO_SIG_INFO* sig);
     LPVOID GetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig,