Stop the SIMD hardware intrinsics types from undergoing crossgen.
authorTanner Gooding <tagoo@outlook.com>
Sat, 20 Jan 2018 18:23:52 +0000 (10:23 -0800)
committerTanner Gooding <tagoo@outlook.com>
Mon, 22 Jan 2018 02:17:18 +0000 (18:17 -0800)
src/vm/methodtablebuilder.cpp

index d25fc95..a47e464 100644 (file)
@@ -1499,7 +1499,21 @@ MethodTableBuilder::BuildMethodTableThrowing(
         LPCUTF8 className;
         LPCUTF8 nameSpace;
         HRESULT hr = GetMDImport()->GetNameOfTypeDef(bmtInternal->pType->GetTypeDefToken(), &className, &nameSpace);
-    
+
+        if (hr == S_OK && strcmp(nameSpace, "System.Runtime.Intrinsics") == 0)
+        {
+            if (IsCompilationProcess())
+            {
+                // Disable AOT compiling for the SIMD hardware intrinsic types. These types require special
+                // ABI handling as they represent fundamental data types (__m64, __m128, and __m256) and not
+                // aggregate or union types. See https://github.com/dotnet/coreclr/issues/15943
+                //
+                // Once they are properly handled according to the ABI requirements, we can remove this check
+                // and allow them to be used in crossgen/AOT scenarios.
+                COMPlusThrow(kTypeLoadException, IDS_EE_HWINTRINSIC_NGEN_DISALLOWED);
+            }
+        }
+
 #if defined(_TARGET_ARM64_)
         // All the funtions in System.Runtime.Intrinsics.Arm.Arm64 are hardware intrinsics.
         if (hr == S_OK && strcmp(nameSpace, "System.Runtime.Intrinsics.Arm.Arm64") == 0)